Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have the route (attached bellow).
I have to dynamically redirect the messages depending on the Http verb (I tried to do it using another approch but it was an epic fail )
used the link
The problem is that only the "DELETE" method is working, and yet I have the error:
:1:1: Fin prématurée du fichier.
: org.apache.camel.processor.DefaultErrorHandler - Failed delivery for (MessageId: ID-LFR204094-55535-1439324535115-0-3 on ExchangeId: ID-LFR204094-55535-1439324535115-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange]
while with the GET or POST methods all I have is this error:
:1:1: Contenu non autorisé dans le prologue.
: org.apache.camel.processor.DefaultErrorHandler - Failed delivery for (MessageId: ID-LFR204094-56301-1439325581670-0-3 on ExchangeId: ID-LFR204094-56301-1439325581670-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange]
I bridged the URLs:
"http://localhost:8081/webMavenChouette?bridgeEndpoint=true&throwExceptionOnFailure=false"
please find attached the snapshots of the route and the bean:
Thank you for your time
-Regards
: org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@localhost:8084
: org.apache.camel.spring.SpringCamelContext - Route: Base_cHttp_1 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: POST_cMessagingEndpoint_1 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: GET_cMessagingEndpoint_2 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: DELETE_cMessagingEndpoint_3 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Total 4 routes, of which 4 is started.
: org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.2 (CamelContext: RouteChouetteSplit-ctx) started in 1.790 seconds
: chouetteRoute.cLog_7 - GET CLIENT
: org.apache.commons.httpclient.HttpMethodDirector - I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
: org.apache.commons.httpclient.HttpMethodDirector - Retrying request
: org.apache.commons.httpclient.HttpMethodDirector - I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
: org.apache.commons.httpclient.HttpMethodDirector - Retrying request
: org.apache.commons.httpclient.HttpMethodDirector - I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
: org.apache.commons.httpclient.HttpMethodDirector - Retrying request
: org.slf4j.Logger - Failed delivery for (MessageId: ID-LFR204094-53626-1439369472006-0-2 on ExchangeId: ID-LFR204094-53626-1439369472006-0-1). Exhausted after delivery attempt: 1 caught: java.net.ConnectException: Connection refused: connect
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
]
]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:244)
at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:144)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at routines.system.CamelStat$1$1.process(CamelStat.java:56)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
at org.apache.camel.processor.RoutingSlip$2.doInAsyncProducer(RoutingSlip.java:301)
at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:304)
at org.apache.camel.processor.RoutingSlip.processExchange(RoutingSlip.java:294)
at org.apache.camel.processor.RoutingSlip.doRoutingSlip(RoutingSlip.java:215)
at org.apache.camel.processor.RoutingSlip.process(RoutingSlip.java:146)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at routines.system.CamelStat$1$1.process(CamelStat.java:56)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.component.jetty.CamelContinuationServlet.service(CamelContinuationServlet.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
at org.eclipse.jetty.servlets.MultiPartFilter.doFilter(MultiPartFilter.java:136)
at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:43)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1465)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
Démarrage du job testDynamicRouter a 15:12 13/08/2015.: org.apache.camel.main.MainSupport - Apache Camel 2.15.2 starting: org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@38d760bb: startup date ; root of context hierarchy: org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singlet
URI="http://localhost:8081/webMavenChouette?bridgeEndpoint=true&throwExceptionOnFailure=false"
public String setURI(Document document,@Header(Exchange.SLIP_ENDPOINT) String previous,
@Header(Exchange.HTTP_METHOD) String httpVerb) {
if (previous != null) {
return null;
}
return "direct:" + httpVerb;
public String setURI(Document document,@Header(Exchange.SLIP_ENDPOINT) String previous,
@Header(Exchange.HTTP_METHOD) String httpVerb) {
if (previous != null) {
return null;
}
System.out.out.println("direct:"+httpVerb); //<--- This code to see what is produced
return "direct:" + httpVerb;
}
String jsonString = exchange.getIn().getBody(String.class);
exchange.getIn().setBody(jsonString);