modified classes
This commit is contained in:
		| @@ -12,10 +12,7 @@ import javax.xml.transform.TransformerFactory; | ||||
| import javax.xml.transform.dom.DOMSource; | ||||
| import javax.xml.transform.stream.StreamResult; | ||||
| import java.io.File; | ||||
| import java.util.ArrayList; | ||||
| import java.util.LinkedHashMap; | ||||
| import java.util.List; | ||||
| import java.util.Scanner; | ||||
| import java.util.*; | ||||
|  | ||||
| public class DAO { | ||||
|  | ||||
| @@ -28,10 +25,10 @@ public class DAO { | ||||
|         return xml; | ||||
|     } | ||||
|  | ||||
|     static int counter=0; | ||||
|     public void hello(){ | ||||
|         counter++; | ||||
|         System.out.println("helloWorld"+counter); | ||||
|     public String getId(HashMap packageMap) throws InterruptedException { | ||||
|         System.out.println(packageMap.get("id")); | ||||
|         Thread.sleep(1000); | ||||
|         return String.valueOf(packageMap.get("id")); | ||||
|     } | ||||
|  | ||||
|     public void splitPackage(LinkedHashMap packageMap) { | ||||
| @@ -117,7 +114,7 @@ public class DAO { | ||||
|         String xml = ""; | ||||
|         Scanner myReader = new Scanner(file); | ||||
|         while (myReader.hasNextLine()) { | ||||
|             xml+=myReader.nextLine()+"\n"; | ||||
|             xml += myReader.nextLine() + "\n"; | ||||
|         } | ||||
|  | ||||
|         return xml; | ||||
|   | ||||
| @@ -37,7 +37,10 @@ public class Main { | ||||
|         connectionFactory.setPassword("admin"); | ||||
|         context.addComponent("activemq", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); | ||||
|  | ||||
|         //DAO dao = new DAO(); | ||||
|         DAO myFunctions = new DAO(); | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|         context.addRoutes(new RouteBuilder() { | ||||
| @@ -46,11 +49,14 @@ public class Main { | ||||
|  | ||||
|                 from("direct:start").to("jdbc:source") | ||||
|                         .split(body()) | ||||
|                         //.bean(myFunctions, "splitMaterial") | ||||
|                         .to("activemq:queue:material") | ||||
|                         .to("log:?level=INFO&showBody=true"); | ||||
|  | ||||
|                 from("activemq:queue:material") | ||||
|                         .setBody(constant("SELECT * FROM package WHERE material_id = 1" + from("activemq:queue:material"))) | ||||
|                         .split(body()) | ||||
|                         .bean(myFunctions, "getId") | ||||
|                         .setBody(constant("SELECT * FROM package WHERE material_id = 1")) | ||||
|                         .to("jdbc:source") | ||||
|                         .to("activemq:queue:materialPackage") | ||||
|                         .to("log:?level=INFO&showBody=true"); | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user