You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Carlo Camerino <ca...@gmail.com> on 2010/03/01 07:38:58 UTC

How To Handle Mina Correlation

Hi,

I would like to ask if this is possible, I am sending a message to an
external tcp/ip server via apache mina so i configure it in my camel
context.
I'm using one thread to send it and another thread is polling for the
reply messages,

Is there a possibility for me to be able to correlate the response
based on a return message coming from the tcp/ip

For example I send two messages

Thread 1 Sending --> A010101TRANSACTION
Thread 2 Sending --> B020202TRANSACTION-TWO

Receiver Thread Getting --> A010101REPLY-TRANSACTION
Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO

How can I match this thread based on A010101 --> assuming this is the
correlation id that i want to set. How can I make sure that Thread 1
will be the one getting it and not thread 2?

I've seen a new pattern called Return Address? How can I implement it
with TCP/IP. Afaik, it can easily be done via the JMS Component.
Is it possible via camel's tcp component?

Thanks
Carlo

Re: How To Handle Mina Correlation

Posted by Carlo Camerino <ca...@gmail.com>.
anandsk,

i saw this somewhere

http://bci.fuw.edu.pl/wiki/Multiplexer

<http://bci.fuw.edu.pl/wiki/Multiplexer>it has some code available in google
code if you would take a look at it

On Tue, Mar 2, 2010 at 1:06 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Mon, Mar 1, 2010 at 5:25 PM, anandsk <sk...@arccorp.com> wrote:
> >
> > Thank you for quick response. In the documentation it says, it is
> supported
> > for jetty component only. Can I use it with apache Mina?. would the
> codecs
> > work with this toasync use. can I use 2.2 in prod or should I wait for it
> > stabilize a bit.
> >
>
> You can use it with Mina but the Camel will fallback to a simulated mode.
> Where Camel internally blocks and waits for the reply in an internal
> thread pool.
>
> Its just that with Jetty you can leverage the first class feature
> inside Jetty to notify Camel when the reply is ready.
>
> It is my expectations that Mina 2.0 has something similar as that.
>
>
> >
> >
> > Claus Ibsen-2 wrote:
> >>
> >> On Mon, Mar 1, 2010 at 3:42 PM, anandsk <sk...@arccorp.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> can you please share your code of thread polling for a response. I am
> >>> also
> >>> need to send a message to extranl tcp/ip server visa apache mina. I
> can't
> >>> wait for the response so I need to poll for a response, can you please
> >>> share
> >>> your code if you don't mind.I don't need to correlate because I do send
> >>> id
> >>> within the message and same id would be sent back in response.
> >>>
> >>
> >> You can use the new toAsync in Camel 2.2 to simulate non blocking
> >> request/reply.
> >>
> >>
> >>
> >>> Thanks,
> >>> Anand
> >>>
> >>>
> >>> carlo c wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> I would like to ask if this is possible, I am sending a message to an
> >>>> external tcp/ip server via apache mina so i configure it in my camel
> >>>> context.
> >>>> I'm using one thread to send it and another thread is polling for the
> >>>> reply messages,
> >>>>
> >>>> Is there a possibility for me to be able to correlate the response
> >>>> based on a return message coming from the tcp/ip
> >>>>
> >>>> For example I send two messages
> >>>>
> >>>> Thread 1 Sending --> A010101TRANSACTION
> >>>> Thread 2 Sending --> B020202TRANSACTION-TWO
> >>>>
> >>>> Receiver Thread Getting --> A010101REPLY-TRANSACTION
> >>>> Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO
> >>>>
> >>>> How can I match this thread based on A010101 --> assuming this is the
> >>>> correlation id that i want to set. How can I make sure that Thread 1
> >>>> will be the one getting it and not thread 2?
> >>>>
> >>>> I've seen a new pattern called Return Address? How can I implement it
> >>>> with TCP/IP. Afaik, it can easily be done via the JMS Component.
> >>>> Is it possible via camel's tcp component?
> >>>>
> >>>> Thanks
> >>>> Carlo
> >>>>
> >>>>
> >>>
> >>> --
> >>> View this message in context:
> >>>
> http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27744410.html
> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> Apache Camel Committer
> >>
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >> Open Source Integration: http://fusesource.com
> >> Blog: http://davsclaus.blogspot.com/
> >> Twitter: http://twitter.com/davsclaus
> >>
> >>
> >
> > --
> > View this message in context:
> http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27745671.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: How To Handle Mina Correlation

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Mar 1, 2010 at 5:25 PM, anandsk <sk...@arccorp.com> wrote:
>
> Thank you for quick response. In the documentation it says, it is supported
> for jetty component only. Can I use it with apache Mina?. would the codecs
> work with this toasync use. can I use 2.2 in prod or should I wait for it
> stabilize a bit.
>

You can use it with Mina but the Camel will fallback to a simulated mode.
Where Camel internally blocks and waits for the reply in an internal
thread pool.

Its just that with Jetty you can leverage the first class feature
inside Jetty to notify Camel when the reply is ready.

It is my expectations that Mina 2.0 has something similar as that.


>
>
> Claus Ibsen-2 wrote:
>>
>> On Mon, Mar 1, 2010 at 3:42 PM, anandsk <sk...@arccorp.com> wrote:
>>>
>>> Hi,
>>>
>>> can you please share your code of thread polling for a response. I am
>>> also
>>> need to send a message to extranl tcp/ip server visa apache mina. I can't
>>> wait for the response so I need to poll for a response, can you please
>>> share
>>> your code if you don't mind.I don't need to correlate because I do send
>>> id
>>> within the message and same id would be sent back in response.
>>>
>>
>> You can use the new toAsync in Camel 2.2 to simulate non blocking
>> request/reply.
>>
>>
>>
>>> Thanks,
>>> Anand
>>>
>>>
>>> carlo c wrote:
>>>>
>>>> Hi,
>>>>
>>>> I would like to ask if this is possible, I am sending a message to an
>>>> external tcp/ip server via apache mina so i configure it in my camel
>>>> context.
>>>> I'm using one thread to send it and another thread is polling for the
>>>> reply messages,
>>>>
>>>> Is there a possibility for me to be able to correlate the response
>>>> based on a return message coming from the tcp/ip
>>>>
>>>> For example I send two messages
>>>>
>>>> Thread 1 Sending --> A010101TRANSACTION
>>>> Thread 2 Sending --> B020202TRANSACTION-TWO
>>>>
>>>> Receiver Thread Getting --> A010101REPLY-TRANSACTION
>>>> Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO
>>>>
>>>> How can I match this thread based on A010101 --> assuming this is the
>>>> correlation id that i want to set. How can I make sure that Thread 1
>>>> will be the one getting it and not thread 2?
>>>>
>>>> I've seen a new pattern called Return Address? How can I implement it
>>>> with TCP/IP. Afaik, it can easily be done via the JMS Component.
>>>> Is it possible via camel's tcp component?
>>>>
>>>> Thanks
>>>> Carlo
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27744410.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27745671.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: How To Handle Mina Correlation

Posted by anandsk <sk...@arccorp.com>.
Thank you for quick response. In the documentation it says, it is supported
for jetty component only. Can I use it with apache Mina?. would the codecs
work with this toasync use. can I use 2.2 in prod or should I wait for it
stabilize a bit.



Claus Ibsen-2 wrote:
> 
> On Mon, Mar 1, 2010 at 3:42 PM, anandsk <sk...@arccorp.com> wrote:
>>
>> Hi,
>>
>> can you please share your code of thread polling for a response. I am
>> also
>> need to send a message to extranl tcp/ip server visa apache mina. I can't
>> wait for the response so I need to poll for a response, can you please
>> share
>> your code if you don't mind.I don't need to correlate because I do send
>> id
>> within the message and same id would be sent back in response.
>>
> 
> You can use the new toAsync in Camel 2.2 to simulate non blocking
> request/reply.
> 
> 
> 
>> Thanks,
>> Anand
>>
>>
>> carlo c wrote:
>>>
>>> Hi,
>>>
>>> I would like to ask if this is possible, I am sending a message to an
>>> external tcp/ip server via apache mina so i configure it in my camel
>>> context.
>>> I'm using one thread to send it and another thread is polling for the
>>> reply messages,
>>>
>>> Is there a possibility for me to be able to correlate the response
>>> based on a return message coming from the tcp/ip
>>>
>>> For example I send two messages
>>>
>>> Thread 1 Sending --> A010101TRANSACTION
>>> Thread 2 Sending --> B020202TRANSACTION-TWO
>>>
>>> Receiver Thread Getting --> A010101REPLY-TRANSACTION
>>> Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO
>>>
>>> How can I match this thread based on A010101 --> assuming this is the
>>> correlation id that i want to set. How can I make sure that Thread 1
>>> will be the one getting it and not thread 2?
>>>
>>> I've seen a new pattern called Return Address? How can I implement it
>>> with TCP/IP. Afaik, it can easily be done via the JMS Component.
>>> Is it possible via camel's tcp component?
>>>
>>> Thanks
>>> Carlo
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27744410.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27745671.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How To Handle Mina Correlation

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Mar 1, 2010 at 3:42 PM, anandsk <sk...@arccorp.com> wrote:
>
> Hi,
>
> can you please share your code of thread polling for a response. I am also
> need to send a message to extranl tcp/ip server visa apache mina. I can't
> wait for the response so I need to poll for a response, can you please share
> your code if you don't mind.I don't need to correlate because I do send id
> within the message and same id would be sent back in response.
>

You can use the new toAsync in Camel 2.2 to simulate non blocking request/reply.



> Thanks,
> Anand
>
>
> carlo c wrote:
>>
>> Hi,
>>
>> I would like to ask if this is possible, I am sending a message to an
>> external tcp/ip server via apache mina so i configure it in my camel
>> context.
>> I'm using one thread to send it and another thread is polling for the
>> reply messages,
>>
>> Is there a possibility for me to be able to correlate the response
>> based on a return message coming from the tcp/ip
>>
>> For example I send two messages
>>
>> Thread 1 Sending --> A010101TRANSACTION
>> Thread 2 Sending --> B020202TRANSACTION-TWO
>>
>> Receiver Thread Getting --> A010101REPLY-TRANSACTION
>> Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO
>>
>> How can I match this thread based on A010101 --> assuming this is the
>> correlation id that i want to set. How can I make sure that Thread 1
>> will be the one getting it and not thread 2?
>>
>> I've seen a new pattern called Return Address? How can I implement it
>> with TCP/IP. Afaik, it can easily be done via the JMS Component.
>> Is it possible via camel's tcp component?
>>
>> Thanks
>> Carlo
>>
>>
>
> --
> View this message in context: http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27744410.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: How To Handle Mina Correlation

Posted by anandsk <sk...@arccorp.com>.
Hi,

can you please share your code of thread polling for a response. I am also
need to send a message to extranl tcp/ip server visa apache mina. I can't
wait for the response so I need to poll for a response, can you please share
your code if you don't mind.I don't need to correlate because I do send id
within the message and same id would be sent back in response.

Thanks,
Anand
 

carlo c wrote:
> 
> Hi,
> 
> I would like to ask if this is possible, I am sending a message to an
> external tcp/ip server via apache mina so i configure it in my camel
> context.
> I'm using one thread to send it and another thread is polling for the
> reply messages,
> 
> Is there a possibility for me to be able to correlate the response
> based on a return message coming from the tcp/ip
> 
> For example I send two messages
> 
> Thread 1 Sending --> A010101TRANSACTION
> Thread 2 Sending --> B020202TRANSACTION-TWO
> 
> Receiver Thread Getting --> A010101REPLY-TRANSACTION
> Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO
> 
> How can I match this thread based on A010101 --> assuming this is the
> correlation id that i want to set. How can I make sure that Thread 1
> will be the one getting it and not thread 2?
> 
> I've seen a new pattern called Return Address? How can I implement it
> with TCP/IP. Afaik, it can easily be done via the JMS Component.
> Is it possible via camel's tcp component?
> 
> Thanks
> Carlo
> 
> 

-- 
View this message in context: http://old.nabble.com/How-To-Handle-Mina-Correlation-tp27740538p27744410.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How To Handle Mina Correlation

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Mar 1, 2010 at 7:38 AM, Carlo Camerino <ca...@gmail.com> wrote:
> Hi,
>
> I would like to ask if this is possible, I am sending a message to an
> external tcp/ip server via apache mina so i configure it in my camel
> context.
> I'm using one thread to send it and another thread is polling for the
> reply messages,
>
> Is there a possibility for me to be able to correlate the response
> based on a return message coming from the tcp/ip
>
> For example I send two messages
>
> Thread 1 Sending --> A010101TRANSACTION
> Thread 2 Sending --> B020202TRANSACTION-TWO
>
> Receiver Thread Getting --> A010101REPLY-TRANSACTION
> Receiver Thread Getting --> B020202REPLY-TRANSACTION-TWO
>
> How can I match this thread based on A010101 --> assuming this is the
> correlation id that i want to set. How can I make sure that Thread 1
> will be the one getting it and not thread 2?
>

I recon Mina 2.0 had some better/initial support for correlation. And
hence we have waited for Mina 2.0 to become GA but it appears to
taking a very very very long time for the Mina guys to get that done.

I suggest to checkout on the Mina documentation about correlating Mina
request/reply.

> I've seen a new pattern called Return Address? How can I implement it
> with TCP/IP. Afaik, it can easily be done via the JMS Component.
> Is it possible via camel's tcp component?
>

No as TCP is very low level. Again check out Mina 2.0 to see what it
offers in terms of correlation request/reply.



> Thanks
> Carlo
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus