Wednesday, 15 August 2012

java - Receiving Camel Twitter Consumer Endpoint Data -



java - Receiving Camel Twitter Consumer Endpoint Data -

i have created route looks this:

@override public void configure() throws exception { from("direct:twitter") .from("twitter://timeline/user?type=direct&user=" + this.uri) .choice() .when(body().isinstanceof(status.class)) .process(new mytwitterprocessor()) .convertbodyto(myclass.class) .to("log:do something") .endchoice() .to("log:mi amigo"); }

calling route straight producertemplate.requestbody("direct:twitter", object), expected receive list of myclass.class instances. instead, returning object sent in requestbody method call.

based on log statements "log:do something" can see status objects beingness returned- request , response twitter occuring.

i understand why route configuration returning object send it, rather status object results twitter. have written 2 other routes facebook posts , rss feed. follow similar pattern , homecoming response objects, rather request sent.

i know can alter behavior producertemplate.requestbody(...) returns list of twitter messages.

thank time.

use pollenrich component obtain additional data:

from("direct:twitter") .pollenrich("twitter://timeline/user?type=direct&user=" + this.uri) .choice() ...

alternatively, may utilize next route automatically started:

from("twitter://timeline/user?type=direct&user=" + this.uri) .choice() ...

note, twitter component creates 1 route exchange per returned object , not list.

java twitter apache-camel

No comments:

Post a Comment