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
String jsonString = exchange.getIn().getBody(String.class);
System.out.println(jsonString);
exchange.getIn().setBody(jsonString);
: 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_2 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Total 2 routes, of which 2 is started.
: org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.2 (CamelContext: test2cDynamicRouter-ctx) started in 1.119 seconds
:1:1: Contenu non autorisé dans le prologue.
: org.apache.camel.processor.DefaultErrorHandler - Failed delivery for (MessageId: ID-LFR204094-57607-1439562308204-0-2 on ExchangeId: ID-LFR204094-57607-1439562308204-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)
]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange
]
from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Route: cMessagingEndpoint_2 started and consuming from: Endpoint
: org.apache.camel.spring.SpringCamelContext - Total 2 routes, of which 2 is started.
: org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.2 (CamelContext: test2cDynamicRouter-ctx) started in 1.271 seconds
:1:1: Contenu non autorisé dans le prologue.
: org.apache.camel.processor.DefaultErrorHandler - Failed delivery for (MessageId: ID-LFR204094-52305-1439564677351-0-2 on ExchangeId: ID-LFR204094-52305-1439564677351-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)
]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange
]
String jsonString = exchange.getIn().getBody(String.class);
System.out.println("THE JSON STRING = "+jsonString);
exchange.getIn().setBody(jsonString);
{"id":14,"objectid":"14","objectVersion":14,"creationTime":null,"creatorId":"14","name":"company14","shortName":"","organizationalUnit":"","operatingDepartmentName":"","code":"","phone":"","fax":"","email":"","registrationNumber":"1","ligneses":[],"vehicleJourneyses":[]}
public class setDynaURI {
public String setURI(Document document,@Header(Exchange.SLIP_ENDPOINT) String previous,
@Header(Exchange.HTTP_METHOD) String httpVerb) {
if (previous != null) {
return null;
}
System.out.println("direct:" + httpVerb);
return "direct:" + httpVerb;
}
}
System.out.println("Previous = " + previous + " and httpverb = " + httpVerb);