camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mister blinky <misterbli...@gmail.com>
Subject Re: Calling route via direct that does an HTTP POST
Date Thu, 27 Feb 2014 19:53:59 GMT
Here's a bit more information. Here's an abbreviated route:

		from("direct:httpApiPost")
		.log("@@@1 header value of 'propsId': ${header.propsId}")
		.log("#################################### here")

		.from("file:ooziejob.property?fileName=job.oozieRunFPG&noop=true")
		.log("@@@2 header value of 'propsId': ${header.propsId}")
		.process(new Processor() {
			public void process(Exchange msg) {
				
				File file = msg.getIn().getBody(File.class);
				LOG.info("@@@@@@@@@ File to POST: " + file);
			}
		})
		.setHeader(Exchange.HTTP_METHOD, constant("POST"))
		.setHeader(Exchange.CONTENT_TYPE, constant("application/xml"))
		.setHeader(Exchange.HTTP_CHARACTER_ENCODING, constant("UTF-8"))
		.to("http://localhost:8080/TestAPI/TestWebService")

        .end();

And here's an annotated (IN ALL CAPS) snippet of what shows up in the log:

[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: httpApiPost
started and consuming from: Endpoint[direct://httpApiPost]
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: httpApiPost
started and consuming from:
Endpoint[file://ooziejob.property?fileName=job.oozieRunFPG&noop=true]
*** BOTH 'FROM' CONSUMERS STARTED ***
[main] INFO httpApiPost - @@@1 header value of 'propsId': testpost
*** WHEN THE 'DIRECT' CONSUMER IS INVOKED, THE PASSED-IN HEADER IS PRESENT
***
[main] INFO httpApiPost - #################################### here
[main] INFO httpApiPost - @@@2 header value of 'propsId': testpost
*** WHEN THE 'FILE' CONSUMER IS INVOKED WITHIN THE FLOW OF THE 'DIRECT'
CONSUMER, THE PASSED-IN HEADER IS STILL PRESENT ***
[main] INFO com.ds.research.camel.route.api.HttpApiPost - @@@@@@@@@ File to
POST: 
*** BUT THERE IS NO FILE TO POST ***
[main] INFO httpApiPost - @@@ URL: localhost:8080/TestAPI/TestWebService?
[main] INFO httpApiPost - @@@ HTTP Response body: No file

[Camel (camel-1) thread #1 - file://ooziejob.property] INFO httpApiPost -
@@@1 header value of 'propsId': 
*** THE 'FILE' CONSUMER IS HERE INVOKED INDEPENDENTLY OF THE 'DIRECT'
CONSUMER ***
[Camel (camel-1) thread #1 - file://ooziejob.property] INFO httpApiPost -
#################################### here
[Camel (camel-1) thread #1 - file://ooziejob.property] INFO httpApiPost -
@@@2 header value of 'propsId': 
*** WHEN THE 'FILE' CONSUMER IS INVOKED NOW, THE PASSED-IN HEADER IS __not__
PRESENT ***
[Camel (camel-1) thread #1 - file://ooziejob.property] INFO
com.ds.research.camel.route.api.HttpApiPost - @@@@@@@@@ File to POST:
C:\Users\T3S\workspace_car\CARCamel\ooziejob.property\job.oozieRunFPG
[Camel (camel-1) thread #1 - file://ooziejob.property] INFO httpApiPost -
@@@ URL: localhost:8080/TestAPI/TestWebService?
[Camel (camel-1) thread #1 - file://ooziejob.property] INFO httpApiPost -
@@@ HTTP Response body: File is posted





--
View this message in context: http://camel.465427.n5.nabble.com/Calling-route-via-direct-that-does-an-HTTP-POST-tp5748043p5748045.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message