You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pvenini <pv...@mervaros.com.ar> on 2011/12/01 21:47:46 UTC

Problem with detour

Hi, I'm using a detour so that if a message has a "suscription" flag it then
connects to a database and creates an entry (in addition to the normal
processing of the message).

from("quickfix:marketdata.cfg").
filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.MARKET_DATA_REQUEST)).
unmarshal(camelDataFormat).
choice().
  when().method("marketDataSuscription", "isSubscription").process(new
SuscriptionProcessor()).to("jdbc:marketDataSuscription").end().	
process(new FixMarketDataRequestProcessor()).
to("jetty:{{http.marketdataunicast}}").
split().method("marketDataSplitter", "split").
process(new MarketDataSplitterProcessor());

However it gives a compile time error at the last "process" call with the
following error:
"The method process(MarketDataSplitterProcessor) is undefined for the type
Object"

I tried replacing the end() with an endChoice(); it compiles but then it
gives a run time error:

Exception in thread "main" java.lang.ClassCastException:
org.apache.camel.model.FilterDefinition cannot be cast to
org.apache.camel.model.ChoiceDefinition
	at
org.apache.camel.model.ProcessorDefinition.endChoice(ProcessorDefinition.java:1124)
	at
ar.com.mervaros.gateway.MyRouteBuilder.configure(MyRouteBuilder.java:125)
	at
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
	at
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
	at
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
	at
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
	at ar.com.mervaros.gateway.Gateway.main(Gateway.java:33)


Any tip would be apreciated.

Thanks

Pablo

--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-detour-tp5039887p5039887.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with detour

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 1, 2011 at 9:47 PM, pvenini <pv...@mervaros.com.ar> wrote:
> Hi, I'm using a detour so that if a message has a "suscription" flag it then
> connects to a database and creates an entry (in addition to the normal
> processing of the message).
>
> from("quickfix:marketdata.cfg").
> filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.MARKET_DATA_REQUEST)).
> unmarshal(camelDataFormat).
> choice().
>  when().method("marketDataSuscription", "isSubscription").process(new
> SuscriptionProcessor()).to("jdbc:marketDataSuscription").end().
> process(new FixMarketDataRequestProcessor()).
> to("jetty:{{http.marketdataunicast}}").
> split().method("marketDataSplitter", "split").
> process(new MarketDataSplitterProcessor());
>
> However it gives a compile time error at the last "process" call with the
> following error:
> "The method process(MarketDataSplitterProcessor) is undefined for the type
> Object"
>

Hi

You should be able to use a parameter for the split instead, then the
.process should be working

 split(method("marketDataSplitter", "split")).
 process(new MarketDataSplitterProcessor());


> I tried replacing the end() with an endChoice(); it compiles but then it
> gives a run time error:
>
> Exception in thread "main" java.lang.ClassCastException:
> org.apache.camel.model.FilterDefinition cannot be cast to
> org.apache.camel.model.ChoiceDefinition
>        at
> org.apache.camel.model.ProcessorDefinition.endChoice(ProcessorDefinition.java:1124)
>        at
> ar.com.mervaros.gateway.MyRouteBuilder.configure(MyRouteBuilder.java:125)
>        at
> org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
>        at
> org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
>        at
> org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
>        at
> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
>        at ar.com.mervaros.gateway.Gateway.main(Gateway.java:33)
>
>
> Any tip would be apreciated.
>
> Thanks
>
> Pablo
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-detour-tp5039887p5039887.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/