You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mgiammarco <mg...@gmail.com> on 2012/01/18 21:39:22 UTC

Re: Single request with multiple replies over TCP

I have the same problem. I send a message and I expect several ASYNC replies.
Unfortunately I get only ONE reply using either an activemq client with
camel and a java stomp client.

--
View this message in context: http://camel.465427.n5.nabble.com/Single-request-with-multiple-replies-over-TCP-tp5022206p5155849.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Single request with multiple replies over TCP

Posted by Chad Beaulac <ca...@gmail.com>.
You will only get one reply if you're using the camel-mina component. The camel-mina2 component will handle multiple replies. It is not complete yet. 

Regards,
Chad 

Sent from my iPhone

On Jan 18, 2012, at 3:39 PM, mgiammarco <mg...@gmail.com> wrote:

> I have the same problem. I send a message and I expect several ASYNC replies.
> Unfortunately I get only ONE reply using either an activemq client with
> camel and a java stomp client.
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Single-request-with-multiple-replies-over-TCP-tp5022206p5155849.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Single request with multiple replies over TCP

Posted by jonv <jo...@generaldynamics.uk.com>.
If you cant wait for the new mina component you will have to write your own
camel component to do this - at least that is what I ended up doing!
Im new to camel so what I did cannot have the best implementation strategy,
so I will probably replace with the mentioned mina2 component. However a
brief explanation of what I did is below that may be of some help to you:

An example config is below:

<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
    <route id="Client2Server">
      <from
uri="myTCPComp://localhost:11111?respEp=respPathOut&amp;bufferSize=8192"/>
      <log message="Msg from Client to
Server................................" />
      <to
uri="myTCPComp://localhost:22222?respEp=vm:respPathIn&amp;bufferSize=8192"/>
    </route>

    <route id="Server2Client">
      <from uri="vm:respPathIn"/>
      <log message="Msg from Server to Client
................................" />
      <to uri="vm:respPathOut"/>
    </route>
  </camelContext>

The 'myTCPComp' consumer creates a TCP Server on localhost:11111. This also
creates another consumer for the responses - here respPathOut. Any messages
received by vm:respPathOut is returned to the TCP client.
The 'myTCPComp' producer creates a TCP client connecting on localhost:22222.
Any responses will be written to vm:respPathIn.

Also if no manipulation is required for the return messages, and I dont set
the respEp parameter on the uri my code uses a default endpoint for the
responses (so the endpoint vm:default is created by the camel consumer and
messages sent to it from the camel producer. Giving just...

<camelContext xmlns="http://camel.apache.org/schema/spring" trace="false">
    <route id="Client2Server">
      <from uri="myTCPComp://localhost:11111"/>
      <log message="Msg from Client to
Server................................" />
      <to uri="myTCPComp://localhost:22222"/>
    </route>
</camelContext>

Which will do the same as the first example without the response log message
being written.



--
View this message in context: http://camel.465427.n5.nabble.com/Single-request-with-multiple-replies-over-TCP-tp5022206p5157169.html
Sent from the Camel - Users mailing list archive at Nabble.com.