camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VivekDhayalan <dvvi...@gmail.com>
Subject How to configure cxf rsclient bean in Java dsl?
Date Fri, 18 Dec 2015 09:35:03 GMT
I want to define cxf:rsclient in Java dsl instead of xml based dsl.
I have the following defined in Java dsl. 

        from("direct:fromChannel")
        	.split()
        	.tokenizeXML("APIDataMessage").streaming()
        	.unmarshal(jaxb)
        	.convertBodyTo(com.testing.camel.MeasureEvent.class)
        	.setHeader("Content-Type", constant("application/json"))
        	.to("cxfrs://bean://toClient");

And I have the following for RSClient

    @Bean
    public SpringJAXRSClientFactoryBean toClient()
    {
    	SpringJAXRSClientFactoryBean springJAXRSClientFactoryBean = new
SpringJAXRSClientFactoryBean();
    	String measurementEventURL = "http://" + connectorsConfig.getHost() + 
				":" + connectorsConfig.getPort() + "/api/measurementEvents";
    	
    	springJAXRSClientFactoryBean.setBeanId("toClient");
    	springJAXRSClientFactoryBean.setAddress(measurementEventURL);
    
springJAXRSClientFactoryBean.setServiceClass(com.testing.camel.MeasurementEventEndpoint.class);
    	springJAXRSClientFactoryBean.setLoggingFeatureEnabled(true);
    	springJAXRSClientFactoryBean.setSkipFaultLogging(true);
    	springJAXRSClientFactoryBean.setProvider(jsonProvider());
    	return springJAXRSClientFactoryBean;
    }

And here is my jsonProvider definition:

    JacksonJsonProvider jsonProvider()
    {
    	return new JacksonJsonProvider();
    }

And following is the stacktrace that I see while calling this route.

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------

    org.apache.camel.component.cxf.CxfOperationException: JAXRS operation
failed invoking http://0.0.0.0:8089/monnitmysqltsdb?restletMethods=POST with
statusCode: 405
    	at
org.apache.camel.component.cxf.jaxrs.CxfRsProducer.populateCxfRsProducerException(CxfRsProducer.java:419)
    	at
org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:232)
    	at
org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:89)
    	at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
    	at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:169)
    	at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:341)
    	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:164)
    	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
    	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
    	at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
    	at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
    	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
    	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
    	at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:668)
    	at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:596)
    	at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:237)
    	at org.apache.camel.processor.Splitter.process(Splitter.java:104)
    	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
    	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
    	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
    	at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
    	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
    	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
    	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
    	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
    	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
    	at
org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:814)
    	at
org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:84)
    	at
org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:314)
    	at
org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:299)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745) 



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-configure-cxf-rsclient-bean-in-Java-dsl-tp5775242.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message