change code
This commit is contained in:
		| @@ -1,5 +1,6 @@ | |||||||
| package com.release11; | package com.release11; | ||||||
|  |  | ||||||
|  | import org.apache.camel.Exchange; | ||||||
| import org.w3c.dom.Document; | import org.w3c.dom.Document; | ||||||
| import org.w3c.dom.Element; | import org.w3c.dom.Element; | ||||||
|  |  | ||||||
| @@ -25,10 +26,11 @@ public class DAO { | |||||||
|         return xml; |         return xml; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public String getId(HashMap packageMap) throws InterruptedException { |     public void getId(Exchange exchange) throws InterruptedException { | ||||||
|         System.out.println(packageMap.get("id")); |  | ||||||
|         Thread.sleep(1000); |         String tmp = exchange.getIn().getBody().toString(); | ||||||
|         return String.valueOf(packageMap.get("id")); |         System.out.println(tmp); | ||||||
|  |         exchange.getIn().setBody("SELECT * FROM package WHERE material_id = 1"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void splitPackage(LinkedHashMap packageMap) { |     public void splitPackage(LinkedHashMap packageMap) { | ||||||
|   | |||||||
| @@ -55,9 +55,10 @@ public class Main { | |||||||
|  |  | ||||||
|                 from("activemq:queue:material") |                 from("activemq:queue:material") | ||||||
|                         .split(body()) |                         .split(body()) | ||||||
|                         .bean(myFunctions, "getId") |                         //.bean(myFunctions, "getId") | ||||||
|                         .setBody(constant("SELECT * FROM package WHERE material_id = 1")) |                         .setHeader("id", constant("${body[id]}")) | ||||||
|                         .to("jdbc:source") |                         .setBody(constant("SELECT * FROM package WHERE material_id = :?id")) | ||||||
|  |                         .to("jdbc:source?useHeadersAsParameters=true") | ||||||
|                         .to("activemq:queue:materialPackage") |                         .to("activemq:queue:materialPackage") | ||||||
|                         .to("log:?level=INFO&showBody=true"); |                         .to("log:?level=INFO&showBody=true"); | ||||||
|  |  | ||||||
| @@ -66,7 +67,7 @@ public class Main { | |||||||
|  |  | ||||||
|         context.start(); |         context.start(); | ||||||
|         ProducerTemplate template = context.createProducerTemplate(); |         ProducerTemplate template = context.createProducerTemplate(); | ||||||
|         template.sendBody("direct:start", "SELECT * FROM material LIMIT 1"); |         template.sendBody("direct:start", "SELECT * FROM material"); | ||||||
|  |  | ||||||
|         Thread.sleep(1000); |         Thread.sleep(1000); | ||||||
|         //template.setDefaultEndpointUri("activemq:queue:material"); |         //template.setDefaultEndpointUri("activemq:queue:material"); | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user