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.apache.camel.main.MainSupport - Apache Camel 2.15.2 starting
: org.springframework.context.support.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7bc0bd17: 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 singletons in org.springframework.beans.factory.support.Defaul
public void configure() throws java.lang.Exception {
from(uriMap.get("cHttp_3"))
.routeId("Base_cHttp_3")
.choice()
.id("cMessageRouter_1")
.when()
.simple("${header." + org.apache.camel.Exchange.HTTP_METHOD
+ "} == 'GET'")
.setHeader("CamelHttpMethod", constant("GET"))
.to(uriMap.get("cHttp_4"))
.id("cHttp_4")
.choice()
.id("cMessageRouter_2")
.when()
.simple("${header."
+ org.apache.camel.Exchange.HTTP_RESPONSE_CODE
+ "} == 200 ")
.log(org.apache.camel.LoggingLevel.INFO,
"chouetteRoute.cLog_1", "good")
.id("cLog_2")
.when()
.simple("${header."
+ org.apache.camel.Exchange.HTTP_RESPONSE_CODE
+ "} == 200 ")
.log(org.apache.camel.LoggingLevel.ERROR,
"chouetteRoute.cLog_1", "eRREUR")
.id("cLog_9")
.when()
.simple("${header." + org.apache.camel.Exchange.HTTP_METHOD
+ "} == 'POST'")
.setHeader("CamelHttpMethod", constant("POST"))
.setHeader("Content-Type", constant("application/json"))
.to(uriMap.get("cHttp_7"))
.id("cHttp_7")
.choice()
.id("cMessageRouter_4")
.when()
.simple("${header."
+ org.apache.camel.Exchange.HTTP_RESPONSE_CODE
+ "} == 200 ")
.log(org.apache.camel.LoggingLevel.INFO,
"chouetteRoute.cLog_1", "good")
.id("cLog_5")
.when()
.simple("${header."
+ org.apache.camel.Exchange.HTTP_RESPONSE_CODE
+ "} == 404 ")
.log(org.apache.camel.LoggingLevel.ERROR,
"chouetteRoute.cLog_1", "eRREUR")
.id("cLog_6")
.when()
.simple("${header." + org.apache.camel.Exchange.HTTP_METHOD
+ "} == 'DELETE'")
.setHeader("CamelHttpMethod", constant("DELETE"))
.to(uriMap.get("cHttp_1"))
.id("cHttp_1")
.choice()
.id("cMessageRouter_3")
.when()
.simple("${header."
+ org.apache.camel.Exchange.HTTP_RESPONSE_CODE
+ "} == 200 ")
.log(org.apache.camel.LoggingLevel.INFO,
"chouetteRoute.cLog_1", "good")
.id("cLog_3")
.when()
.simple("${header."
+ org.apache.camel.Exchange.HTTP_RESPONSE_CODE
+ "} == 404 ")
.log(org.apache.camel.LoggingLevel.ERROR,
"chouetteRoute.cLog_1", "eRREUR")
.id("cLog_4");
}
: org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@localhost:8087
: org.apache.camel.spring.SpringCamelContext - Route: base_cHttp_1 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: cMessagingEndpoint_1 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: cMessagingEndpoint_2 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: 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: test2cDynamicRouter-ctx) started in 1.277 seconds
: cDynamicRouter.cLog_1 - Exchange]
:43:7: Le type d'élément "meta" doit se terminer par la balise de fin correspondante "".
: org.apache.camel.processor.DefaultErrorHandler - Failed delivery for (MessageId: ID-LFR204094-53910-1439560830380-0-3 on ExchangeId: ID-LFR204094-53910-1439560830380-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange]
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
]
]
]
choice
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange
]