How to setup Camel Jetty for a asynchronous behavior

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to setup Camel Jetty for a asynchronous behavior

catshout
I've a route that consumes from a Jetty endpoint like this ..

		<camel:route id="SAPPI_HTTP_data_to_{{eib.id}}">
			<camel:from uri="jetty:http://0.0.0.0:8182/SAPPI/IN" />
			<camel:transacted id="SAPPI_HTTP_data_to_{{eib.id}}_tx" />
			<camel:to uri="activemq:{{eib.sappi.in.queue}}" />
			<camel:log message="Data from SAP PI to central ActiveMQ routed" />
		</camel:route>

Behind th ActiveMQ queue is configured an other route for processing. The behavior is that I'm getting a response back with the finally processed message and so far the response is blocking until the message has been processed at all.

Is it possible to configure the above route as an HTTP endpoint that captures the incoming data, sends back a response immediately (e.g. HTTP-200) and so far decouples the message receive through HTTP from the rest of the processing?

Best
- Gerald
Reply | Threaded
Open this post in threaded view
|

Re: How to setup Camel Jetty for a asynchronous behavior

Gregor Zurowski-2
Yes, what you want to do is to change the exchange pattern from
request-response ("in-out") to one-way event message ("in-only") when
sending messages to the queue, because you are not interested in any
responses from the ActiveMQ endpoint in your use case. You can use
"transform" for sending a confirmation message back to the client.
This could look as follows:

<route>
   <from uri="jetty:http://0.0.0.0:8182/SAPPI/IN" />
   <transacted id="SAPPI_HTTP_data_to_{{eib.id}}_tx" />
   <inOnly uri="activemq:{{eib.sappi.in.queue}}" />
   <transform>
      <constant>OK<constant>
   </transform>
   <log message="Data from SAP PI to central ActiveMQ routed" />
</route>

Hope this helps,
Gregor

On Thu, Sep 10, 2015 at 1:23 PM, catshout <[hidden email]> wrote:

> I've a route that consumes from a Jetty endpoint like this ..
>
>
>
> Behind th ActiveMQ queue is configured an other route for processing. The
> behavior is that I'm getting a response back with the finally processed
> message and so far the response is blocking until the message has been
> processed at all.
>
> Is it possible to configure the above route as an HTTP endpoint that
> captures the incoming data, sends back a response immediately (e.g.
> HTTP-200) and so far decouples the message receive through HTTP from the
> rest of the processing?
>
> Best
> - Gerald
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/How-to-setup-Camel-Jetty-for-a-asynchronous-behavior-tp5722951.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to setup Camel Jetty for a asynchronous behavior

catshout
Works perfect!

Many thanks Gregor.