camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samslara <samsl...@yahoo.com>
Subject interceptFrom with a new consumer
Date Tue, 14 May 2013 02:23:40 GMT
Hello,
  I have a problem which I'm unsure on how to solve.  So I have a route, say
R1, that's pretty simple:

<route id="R1">
  <from uri="jetty:http://localhost:8080/test"/>
  <bean ref="someProcessor"/>
</route>

Now someProcessor may take a long time to return, so I want to alter the
route's behavior such that it's more "async".  What I mean by this is I want
the from endpoint to return quickly with a confirmation which includes a
correlationId C1 of some sort and for the response from someProcessor to be
associated with the correlationId.  For simplicity sake lets just say it's
some in-memory Map<String, Object>, so in the end it'll be something like
map.put(C1, Response).  If I'm trying not to alter the route R1 itself how
would I do this?

One idea I have is to use an interceptFrom:

<interceptFrom>
  <bean ref="interceptProcessor">
</interceptFrom>

The problem is that I want this interceptProcessor to act more like a
consumer, with it dealing with the response Exchange and for the original
client of route R1 to receive a response quickly which has the correlationId
C1.  Any and all ideas on how to approach this is welcome.

Before:
Client --> R1 --> Client (response)

After:
Client --> R1 --> inteceptProcessor (generates a correlationId C1) -->
Client (only contains C1)

inteceptProcessor (after C1 is generated)--> the rest of R1 -->
interceptProcessor (or possibly another processor to do the map.put(C1,
response))



--
View this message in context: http://camel.465427.n5.nabble.com/interceptFrom-with-a-new-consumer-tp5732453.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message