Netty or Mina Async in the same socket

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

Netty or Mina Async in the same socket

flavio.magacho

Hi,

My name is Flavio Magacho.

I have a specific problem:

 

I´ll receive a socket connection and receive messages in this socket.

The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.

I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.

 

Did anyone knows how to do that?

 

Flavio Magacho

Gerente de Desenvolvimento

Diretoria de Tecnologia da Informação

  M4U
+55 (21) 2546-4050 ▪ Ramal: 4082

+55 (21) 8889-1572

 

þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.

O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.

The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Chad Beaulac
Hi Flavio,

You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.

Chad Beaulac
Objective Solutions, Inc.
www.objectivesolutions.com
[hidden email]


On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:

> Hi,
> My name is Flavio Magacho.
> I have a specific problem:
>  
> I´ll receive a socket connection and receive messages in this socket.
> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>  
> Did anyone knows how to do that?
>  
> Flavio Magacho
> Gerente de Desenvolvimento
> Diretoria de Tecnologia da Informação
>   M4U
> +55 (21) 2546-4050 ▪ Ramal: 4082
> +55 (21) 8889-1572
>  
> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>  
>  








Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Claus Ibsen-2
On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
> Hi Flavio,
>
> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>

He can grab the netty channel as its enriched on the message as a
header. Then use that channel to write the 2nd message back. He would
need to code that. Its a matter though where and when the 2nd message
should be send back.
And what triggers when this should happen.

Maybe you can tell us a bit more about what you do in a Camel route eg?

from netty?sync=false
 to ???

So you want at ?? something to process the incoming message, and use
the same socket to send back a reply message?


> Chad Beaulac
> Objective Solutions, Inc.
> www.objectivesolutions.com
> [hidden email]
>
>
> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>
>> Hi,
>> My name is Flavio Magacho.
>> I have a specific problem:
>>
>> I´ll receive a socket connection and receive messages in this socket.
>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>
>> Did anyone knows how to do that?
>>
>> Flavio Magacho
>> Gerente de Desenvolvimento
>> Diretoria de Tecnologia da Informação
>>   M4U
>> +55 (21) 2546-4050 ▪ Ramal: 4082
>> +55 (21) 8889-1572
>>
>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>
>>
>
>
>
>
>
>
>
>



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

RE: Netty or Mina Async in the same socket

flavio.magacho
Ok Claus let me try to show you what I´m trying to do:

<camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
                <route>
                        <from uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
                        <log message="reading ${bodyt}" />
                        <to uri="activemq:readQueue" />
                </route>
                <route>
                        <from uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
                        <setBody>
                                <simple>Echo: ${body.text}!</simple>
                        </setBody>
                        <log message="Writing ${body}" />
                        <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
                </route>
</camelContext>

And I want to write in the same socket that the messages arrives.
The idea is to make the message exchange process to be Async.

I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?

Thanks,
Magacho

-----Original Message-----
From: Claus Ibsen [mailto:[hidden email]]
Sent: quinta-feira, 4 de outubro de 2012 03:30
To: [hidden email]
Subject: Re: Netty or Mina Async in the same socket

On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
> Hi Flavio,
>
> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>

He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
And what triggers when this should happen.

Maybe you can tell us a bit more about what you do in a Camel route eg?

from netty?sync=false
 to ???

So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?


> Chad Beaulac
> Objective Solutions, Inc.
> www.objectivesolutions.com
> [hidden email]
>
>
> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>
>> Hi,
>> My name is Flavio Magacho.
>> I have a specific problem:
>>
>> I´ll receive a socket connection and receive messages in this socket.
>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>
>> Did anyone knows how to do that?
>>
>> Flavio Magacho
>> Gerente de Desenvolvimento
>> Diretoria de Tecnologia da Informação
>>   M4U
>> +55 (21) 2546-4050 ▪ Ramal: 4082
>> +55 (21) 8889-1572
>>
>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>
>>
>
>
>
>
>
>
>
>



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Claus Ibsen-2
Hi

I have added an unit test that does netty request/reply async and uses
the same channel to write the response back
http://svn.apache.org/viewvc?rev=1394556&view=rev



On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U
<[hidden email]> wrote:

> Ok Claus let me try to show you what I´m trying to do:
>
> <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
>                 <route>
>                         <from   uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
>                         <log message="reading ${bodyt}" />
>                         <to uri="activemq:readQueue" />
>                 </route>
>                 <route>
>                         <from   uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
>                         <setBody>
>                                 <simple>Echo: ${body.text}!</simple>
>                         </setBody>
>                         <log message="Writing ${body}" />
>                         <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
>                 </route>
> </camelContext>
>
> And I want to write in the same socket that the messages arrives.
> The idea is to make the message exchange process to be Async.
>
> I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>
> Thanks,
> Magacho
>
> -----Original Message-----
> From: Claus Ibsen [mailto:[hidden email]]
> Sent: quinta-feira, 4 de outubro de 2012 03:30
> To: [hidden email]
> Subject: Re: Netty or Mina Async in the same socket
>
> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
>> Hi Flavio,
>>
>> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>>
>
> He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
> And what triggers when this should happen.
>
> Maybe you can tell us a bit more about what you do in a Camel route eg?
>
> from netty?sync=false
>  to ???
>
> So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>
>
>> Chad Beaulac
>> Objective Solutions, Inc.
>> www.objectivesolutions.com
>> [hidden email]
>>
>>
>> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>>
>>> Hi,
>>> My name is Flavio Magacho.
>>> I have a specific problem:
>>>
>>> I´ll receive a socket connection and receive messages in this socket.
>>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>>
>>> Did anyone knows how to do that?
>>>
>>> Flavio Magacho
>>> Gerente de Desenvolvimento
>>> Diretoria de Tecnologia da Informação
>>>   M4U
>>> +55 (21) 2546-4050 ▪ Ramal: 4082
>>> +55 (21) 8889-1572
>>>
>>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

RE: Netty or Mina Async in the same socket

flavio.magacho
Claus, Thank you.
It works, I think that I missed the transform tag :).
I Simply set the body.

But I got some concurrency problems.
I opened 2 connections. . . and it mixes data between them.
 
Is this component thread safe?

Thank you!
Magacho


-----Original Message-----
From: Claus Ibsen [mailto:[hidden email]]
Sent: sexta-feira, 5 de outubro de 2012 12:15
To: [hidden email]
Subject: Re: Netty or Mina Async in the same socket

Hi

I have added an unit test that does netty request/reply async and uses the same channel to write the response back http://svn.apache.org/viewvc?rev=1394556&view=rev



On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email]> wrote:

> Ok Claus let me try to show you what I´m trying to do:
>
> <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
>                 <route>
>                         <from   uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
>                         <log message="reading ${bodyt}" />
>                         <to uri="activemq:readQueue" />
>                 </route>
>                 <route>
>                         <from   uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
>                         <setBody>
>                                 <simple>Echo: ${body.text}!</simple>
>                         </setBody>
>                         <log message="Writing ${body}" />
>                         <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
>                 </route>
> </camelContext>
>
> And I want to write in the same socket that the messages arrives.
> The idea is to make the message exchange process to be Async.
>
> I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>
> Thanks,
> Magacho
>
> -----Original Message-----
> From: Claus Ibsen [mailto:[hidden email]]
> Sent: quinta-feira, 4 de outubro de 2012 03:30
> To: [hidden email]
> Subject: Re: Netty or Mina Async in the same socket
>
> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
>> Hi Flavio,
>>
>> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>>
>
> He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
> And what triggers when this should happen.
>
> Maybe you can tell us a bit more about what you do in a Camel route eg?
>
> from netty?sync=false
>  to ???
>
> So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>
>
>> Chad Beaulac
>> Objective Solutions, Inc.
>> www.objectivesolutions.com
>> [hidden email]
>>
>>
>> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>>
>>> Hi,
>>> My name is Flavio Magacho.
>>> I have a specific problem:
>>>
>>> I´ll receive a socket connection and receive messages in this socket.
>>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>>
>>> Did anyone knows how to do that?
>>>
>>> Flavio Magacho
>>> Gerente de Desenvolvimento
>>> Diretoria de Tecnologia da Informação
>>>   M4U
>>> +55 (21) 2546-4050 ▪ Ramal: 4082
>>> +55 (21) 8889-1572
>>>
>>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Claus Ibsen-2
On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
<[hidden email]> wrote:
> Claus, Thank you.
> It works, I think that I missed the transform tag :).
> I Simply set the body.
>
> But I got some concurrency problems.
> I opened 2 connections. . . and it mixes data between them.
>

Ah yeah we should use an ordered thread pool that Netty offers. I
logged a ticket
https://issues.apache.org/jira/browse/CAMEL-5689

> Is this component thread safe?
>
> Thank you!
> Magacho
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:[hidden email]]
> Sent: sexta-feira, 5 de outubro de 2012 12:15
> To: [hidden email]
> Subject: Re: Netty or Mina Async in the same socket
>
> Hi
>
> I have added an unit test that does netty request/reply async and uses the same channel to write the response back http://svn.apache.org/viewvc?rev=1394556&view=rev
>
>
>
> On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email]> wrote:
>> Ok Claus let me try to show you what I´m trying to do:
>>
>> <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
>>                 <route>
>>                         <from   uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
>>                         <log message="reading ${bodyt}" />
>>                         <to uri="activemq:readQueue" />
>>                 </route>
>>                 <route>
>>                         <from   uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
>>                         <setBody>
>>                                 <simple>Echo: ${body.text}!</simple>
>>                         </setBody>
>>                         <log message="Writing ${body}" />
>>                         <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
>>                 </route>
>> </camelContext>
>>
>> And I want to write in the same socket that the messages arrives.
>> The idea is to make the message exchange process to be Async.
>>
>> I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>>
>> Thanks,
>> Magacho
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:[hidden email]]
>> Sent: quinta-feira, 4 de outubro de 2012 03:30
>> To: [hidden email]
>> Subject: Re: Netty or Mina Async in the same socket
>>
>> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
>>> Hi Flavio,
>>>
>>> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>>>
>>
>> He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
>> And what triggers when this should happen.
>>
>> Maybe you can tell us a bit more about what you do in a Camel route eg?
>>
>> from netty?sync=false
>>  to ???
>>
>> So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>>
>>
>>> Chad Beaulac
>>> Objective Solutions, Inc.
>>> www.objectivesolutions.com
>>> [hidden email]
>>>
>>>
>>> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>>>
>>>> Hi,
>>>> My name is Flavio Magacho.
>>>> I have a specific problem:
>>>>
>>>> I´ll receive a socket connection and receive messages in this socket.
>>>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>>>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>>>
>>>> Did anyone knows how to do that?
>>>>
>>>> Flavio Magacho
>>>> Gerente de Desenvolvimento
>>>> Diretoria de Tecnologia da Informação
>>>>   M4U
>>>> +55 (21) 2546-4050 ▪ Ramal: 4082
>>>> +55 (21) 8889-1572
>>>>
>>>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>>>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>>>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Claus Ibsen-2
On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email]> wrote:

> On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
> <[hidden email]> wrote:
>> Claus, Thank you.
>> It works, I think that I missed the transform tag :).
>> I Simply set the body.
>>
>> But I got some concurrency problems.
>> I opened 2 connections. . . and it mixes data between them.
>>
>
> Ah yeah we should use an ordered thread pool that Netty offers. I
> logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-5689
>

I have committed a fix to trunk and 2.10 branch.
I also added a concurrent test with 20 clients and they all get the
expected reply.

If you can try the latest code on trunk or 2.10 branch that would be good.

And also how do you test it with the 2 connections? If there is still
some issue,
we would need a way to reproduce the issue.

>> Is this component thread safe?
>>
>> Thank you!
>> Magacho
>>
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:[hidden email]]
>> Sent: sexta-feira, 5 de outubro de 2012 12:15
>> To: [hidden email]
>> Subject: Re: Netty or Mina Async in the same socket
>>
>> Hi
>>
>> I have added an unit test that does netty request/reply async and uses the same channel to write the response back http://svn.apache.org/viewvc?rev=1394556&view=rev
>>
>>
>>
>> On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email]> wrote:
>>> Ok Claus let me try to show you what I´m trying to do:
>>>
>>> <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
>>>                 <route>
>>>                         <from   uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
>>>                         <log message="reading ${bodyt}" />
>>>                         <to uri="activemq:readQueue" />
>>>                 </route>
>>>                 <route>
>>>                         <from   uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
>>>                         <setBody>
>>>                                 <simple>Echo: ${body.text}!</simple>
>>>                         </setBody>
>>>                         <log message="Writing ${body}" />
>>>                         <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
>>>                 </route>
>>> </camelContext>
>>>
>>> And I want to write in the same socket that the messages arrives.
>>> The idea is to make the message exchange process to be Async.
>>>
>>> I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>>>
>>> Thanks,
>>> Magacho
>>>
>>> -----Original Message-----
>>> From: Claus Ibsen [mailto:[hidden email]]
>>> Sent: quinta-feira, 4 de outubro de 2012 03:30
>>> To: [hidden email]
>>> Subject: Re: Netty or Mina Async in the same socket
>>>
>>> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
>>>> Hi Flavio,
>>>>
>>>> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>>>>
>>>
>>> He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
>>> And what triggers when this should happen.
>>>
>>> Maybe you can tell us a bit more about what you do in a Camel route eg?
>>>
>>> from netty?sync=false
>>>  to ???
>>>
>>> So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>>>
>>>
>>>> Chad Beaulac
>>>> Objective Solutions, Inc.
>>>> www.objectivesolutions.com
>>>> [hidden email]
>>>>
>>>>
>>>> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>>>>
>>>>> Hi,
>>>>> My name is Flavio Magacho.
>>>>> I have a specific problem:
>>>>>
>>>>> I´ll receive a socket connection and receive messages in this socket.
>>>>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>>>>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>>>>
>>>>> Did anyone knows how to do that?
>>>>>
>>>>> Flavio Magacho
>>>>> Gerente de Desenvolvimento
>>>>> Diretoria de Tecnologia da Informação
>>>>>   M4U
>>>>> +55 (21) 2546-4050 ▪ Ramal: 4082
>>>>> +55 (21) 8889-1572
>>>>>
>>>>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>>>>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>>>>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> Red Hat, Inc.
>>> FuseSource is now part of Red Hat
>>> Email: [hidden email]
>>> Web: http://fusesource.com
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

RE: Netty or Mina Async in the same socket

flavio.magacho
Thank you Claus,
I'll try the fix and tell you if it works.

Talking about how I reproduced the problem:
I open 2 telnet connections from different computers and I typed a sequence of 3 letters and an <Enter>, in computer A I typed a sequence of A's and in computer B I typed a sequence of B's.
Doing this sometimes in computer A we have some B's and in the computer B we have also some A's.

One again thank you.
Flavio Magacho


-----Original Message-----
From: Claus Ibsen [mailto:[hidden email]]
Sent: sábado, 6 de outubro de 2012 10:48
To: [hidden email]
Subject: Re: Netty or Mina Async in the same socket

On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email]> wrote:

> On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
> <[hidden email]> wrote:
>> Claus, Thank you.
>> It works, I think that I missed the transform tag :).
>> I Simply set the body.
>>
>> But I got some concurrency problems.
>> I opened 2 connections. . . and it mixes data between them.
>>
>
> Ah yeah we should use an ordered thread pool that Netty offers. I
> logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-5689
>

I have committed a fix to trunk and 2.10 branch.
I also added a concurrent test with 20 clients and they all get the expected reply.

If you can try the latest code on trunk or 2.10 branch that would be good.

And also how do you test it with the 2 connections? If there is still some issue, we would need a way to reproduce the issue.

>> Is this component thread safe?
>>
>> Thank you!
>> Magacho
>>
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:[hidden email]]
>> Sent: sexta-feira, 5 de outubro de 2012 12:15
>> To: [hidden email]
>> Subject: Re: Netty or Mina Async in the same socket
>>
>> Hi
>>
>> I have added an unit test that does netty request/reply async and
>> uses the same channel to write the response back
>> http://svn.apache.org/viewvc?rev=1394556&view=rev
>>
>>
>>
>> On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email]> wrote:
>>> Ok Claus let me try to show you what I´m trying to do:
>>>
>>> <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
>>>                 <route>
>>>                         <from   uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
>>>                         <log message="reading ${bodyt}" />
>>>                         <to uri="activemq:readQueue" />
>>>                 </route>
>>>                 <route>
>>>                         <from   uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
>>>                         <setBody>
>>>                                 <simple>Echo: ${body.text}!</simple>
>>>                         </setBody>
>>>                         <log message="Writing ${body}" />
>>>                         <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
>>>                 </route>
>>> </camelContext>
>>>
>>> And I want to write in the same socket that the messages arrives.
>>> The idea is to make the message exchange process to be Async.
>>>
>>> I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>>>
>>> Thanks,
>>> Magacho
>>>
>>> -----Original Message-----
>>> From: Claus Ibsen [mailto:[hidden email]]
>>> Sent: quinta-feira, 4 de outubro de 2012 03:30
>>> To: [hidden email]
>>> Subject: Re: Netty or Mina Async in the same socket
>>>
>>> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
>>>> Hi Flavio,
>>>>
>>>> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>>>>
>>>
>>> He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
>>> And what triggers when this should happen.
>>>
>>> Maybe you can tell us a bit more about what you do in a Camel route eg?
>>>
>>> from netty?sync=false
>>>  to ???
>>>
>>> So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>>>
>>>
>>>> Chad Beaulac
>>>> Objective Solutions, Inc.
>>>> www.objectivesolutions.com
>>>> [hidden email]
>>>>
>>>>
>>>> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>>>>
>>>>> Hi,
>>>>> My name is Flavio Magacho.
>>>>> I have a specific problem:
>>>>>
>>>>> I´ll receive a socket connection and receive messages in this socket.
>>>>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>>>>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>>>>
>>>>> Did anyone knows how to do that?
>>>>>
>>>>> Flavio Magacho
>>>>> Gerente de Desenvolvimento
>>>>> Diretoria de Tecnologia da Informação
>>>>>   M4U
>>>>> +55 (21) 2546-4050 ▪ Ramal: 4082
>>>>> +55 (21) 8889-1572
>>>>>
>>>>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>>>>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>>>>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> Red Hat, Inc.
>>> FuseSource is now part of Red Hat
>>> Email: [hidden email]
>>> Web: http://fusesource.com
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

RE: Netty or Mina Async in the same socket

flavio.magacho
Claus, I'm testing this case with Servicemmix, how can I change the camel Libs??


-----Original Message-----
From: Flavio Magacho - M4U [mailto:[hidden email]]
Sent: segunda-feira, 8 de outubro de 2012 09:52
To: [hidden email]
Subject: RE: Netty or Mina Async in the same socket

Thank you Claus,
I'll try the fix and tell you if it works.

Talking about how I reproduced the problem:
I open 2 telnet connections from different computers and I typed a sequence of 3 letters and an <Enter>, in computer A I typed a sequence of A's and in computer B I typed a sequence of B's.
Doing this sometimes in computer A we have some B's and in the computer B we have also some A's.

One again thank you.
Flavio Magacho


-----Original Message-----
From: Claus Ibsen [mailto:[hidden email]]
Sent: sábado, 6 de outubro de 2012 10:48
To: [hidden email]
Subject: Re: Netty or Mina Async in the same socket

On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email]> wrote:

> On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
> <[hidden email]> wrote:
>> Claus, Thank you.
>> It works, I think that I missed the transform tag :).
>> I Simply set the body.
>>
>> But I got some concurrency problems.
>> I opened 2 connections. . . and it mixes data between them.
>>
>
> Ah yeah we should use an ordered thread pool that Netty offers. I
> logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-5689
>

I have committed a fix to trunk and 2.10 branch.
I also added a concurrent test with 20 clients and they all get the expected reply.

If you can try the latest code on trunk or 2.10 branch that would be good.

And also how do you test it with the 2 connections? If there is still some issue, we would need a way to reproduce the issue.

>> Is this component thread safe?
>>
>> Thank you!
>> Magacho
>>
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:[hidden email]]
>> Sent: sexta-feira, 5 de outubro de 2012 12:15
>> To: [hidden email]
>> Subject: Re: Netty or Mina Async in the same socket
>>
>> Hi
>>
>> I have added an unit test that does netty request/reply async and
>> uses the same channel to write the response back
>> http://svn.apache.org/viewvc?rev=1394556&view=rev
>>
>>
>>
>> On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email]> wrote:
>>> Ok Claus let me try to show you what I´m trying to do:
>>>
>>> <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
>>>                 <route>
>>>                         <from   uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
>>>                         <log message="reading ${bodyt}" />
>>>                         <to uri="activemq:readQueue" />
>>>                 </route>
>>>                 <route>
>>>                         <from   uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
>>>                         <setBody>
>>>                                 <simple>Echo: ${body.text}!</simple>
>>>                         </setBody>
>>>                         <log message="Writing ${body}" />
>>>                         <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
>>>                 </route>
>>> </camelContext>
>>>
>>> And I want to write in the same socket that the messages arrives.
>>> The idea is to make the message exchange process to be Async.
>>>
>>> I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>>>
>>> Thanks,
>>> Magacho
>>>
>>> -----Original Message-----
>>> From: Claus Ibsen [mailto:[hidden email]]
>>> Sent: quinta-feira, 4 de outubro de 2012 03:30
>>> To: [hidden email]
>>> Subject: Re: Netty or Mina Async in the same socket
>>>
>>> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email]> wrote:
>>>> Hi Flavio,
>>>>
>>>> You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>>>>
>>>
>>> He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
>>> And what triggers when this should happen.
>>>
>>> Maybe you can tell us a bit more about what you do in a Camel route eg?
>>>
>>> from netty?sync=false
>>>  to ???
>>>
>>> So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>>>
>>>
>>>> Chad Beaulac
>>>> Objective Solutions, Inc.
>>>> www.objectivesolutions.com
>>>> [hidden email]
>>>>
>>>>
>>>> On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>>>>
>>>>> Hi,
>>>>> My name is Flavio Magacho.
>>>>> I have a specific problem:
>>>>>
>>>>> I´ll receive a socket connection and receive messages in this socket.
>>>>> The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>>>>> I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>>>>>
>>>>> Did anyone knows how to do that?
>>>>>
>>>>> Flavio Magacho
>>>>> Gerente de Desenvolvimento
>>>>> Diretoria de Tecnologia da Informação
>>>>>   M4U
>>>>> +55 (21) 2546-4050 ▪ Ramal: 4082
>>>>> +55 (21) 8889-1572
>>>>>
>>>>> þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>>>>> O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>>>>> The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> Red Hat, Inc.
>>> FuseSource is now part of Red Hat
>>> Email: [hidden email]
>>> Web: http://fusesource.com
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email]
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Willem.Jiang
Administrator
It's depends on what's version of service mix are you using.
As Apache Camel provides patch releases, it could be possible that you just replace the camel-netty or camel-mina jars with that latest one.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: willemjiang





On Tuesday, October 9, 2012 at 2:14 AM, Flavio Magacho - M4U wrote:

> Claus, I'm testing this case with Servicemmix, how can I change the camel Libs??
>  
>  
> -----Original Message-----
> From: Flavio Magacho - M4U [mailto:[hidden email]]  
> Sent: segunda-feira, 8 de outubro de 2012 09:52
> To: [hidden email] (mailto:[hidden email])
> Subject: RE: Netty or Mina Async in the same socket
>  
> Thank you Claus,
> I'll try the fix and tell you if it works.
>  
> Talking about how I reproduced the problem:
> I open 2 telnet connections from different computers and I typed a sequence of 3 letters and an <Enter>, in computer A I typed a sequence of A's and in computer B I typed a sequence of B's.
> Doing this sometimes in computer A we have some B's and in the computer B we have also some A's.
>  
> One again thank you.
> Flavio Magacho
>  
>  
> -----Original Message-----
> From: Claus Ibsen [mailto:[hidden email]]
> Sent: sábado, 6 de outubro de 2012 10:48
> To: [hidden email] (mailto:[hidden email])
> Subject: Re: Netty or Mina Async in the same socket
>  
> On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email] (mailto:[hidden email])> wrote:
> > On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U  
> > <[hidden email] (mailto:[hidden email])> wrote:
> > > Claus, Thank you.
> > > It works, I think that I missed the transform tag :).
> > > I Simply set the body.
> > >  
> > > But I got some concurrency problems.
> > > I opened 2 connections. . . and it mixes data between them.
> >  
> >  
> >  
> > Ah yeah we should use an ordered thread pool that Netty offers. I  
> > logged a ticket
> > https://issues.apache.org/jira/browse/CAMEL-5689
>  
>  
>  
> I have committed a fix to trunk and 2.10 branch.
> I also added a concurrent test with 20 clients and they all get the expected reply.
>  
> If you can try the latest code on trunk or 2.10 branch that would be good.
>  
> And also how do you test it with the 2 connections? If there is still some issue, we would need a way to reproduce the issue.
>  
> > > Is this component thread safe?
> > >  
> > > Thank you!
> > > Magacho
> > >  
> > >  
> > > -----Original Message-----
> > > From: Claus Ibsen [mailto:[hidden email]]
> > > Sent: sexta-feira, 5 de outubro de 2012 12:15
> > > To: [hidden email] (mailto:[hidden email])
> > > Subject: Re: Netty or Mina Async in the same socket
> > >  
> > > Hi
> > >  
> > > I have added an unit test that does netty request/reply async and  
> > > uses the same channel to write the response back  
> > > http://svn.apache.org/viewvc?rev=1394556&view=rev
> > >  
> > >  
> > >  
> > > On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email] (mailto:[hidden email])> wrote:
> > > > Ok Claus let me try to show you what I´m trying to do:
> > > >  
> > > > <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
> > > > <route>
> > > > <from uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
> > > > <log message="reading ${bodyt}" />
> > > > <to uri="activemq:readQueue" />
> > > > </route>
> > > > <route>
> > > > <from uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
> > > > <setBody>
> > > > <simple>Echo: ${body.text}!</simple>
> > > > </setBody>
> > > > <log message="Writing ${body}" />
> > > > <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
> > > > </route>
> > > > </camelContext>
> > > >  
> > > > And I want to write in the same socket that the messages arrives.
> > > > The idea is to make the message exchange process to be Async.
> > > >  
> > > > I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
> > > >  
> > > > Thanks,
> > > > Magacho
> > > >  
> > > > -----Original Message-----
> > > > From: Claus Ibsen [mailto:[hidden email]]
> > > > Sent: quinta-feira, 4 de outubro de 2012 03:30
> > > > To: [hidden email] (mailto:[hidden email])
> > > > Subject: Re: Netty or Mina Async in the same socket
> > > >  
> > > > On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email] (mailto:[hidden email])> wrote:
> > > > > Hi Flavio,
> > > > >  
> > > > > You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
> > > >  
> > > > He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
> > > > And what triggers when this should happen.
> > > >  
> > > > Maybe you can tell us a bit more about what you do in a Camel route eg?
> > > >  
> > > > from netty?sync=false
> > > > to ???
> > > >  
> > > > So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
> > > >  
> > > >  
> > > > > Chad Beaulac
> > > > > Objective Solutions, Inc.
> > > > > www.objectivesolutions.com (http://www.objectivesolutions.com)
> > > > > [hidden email] (mailto:[hidden email])
> > > > >  
> > > > >  
> > > > > On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
> > > > >  
> > > > > > Hi,
> > > > > > My name is Flavio Magacho.
> > > > > > I have a specific problem:
> > > > > >  
> > > > > > I´ll receive a socket connection and receive messages in this socket.
> > > > > > The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
> > > > > > I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
> > > > > >  
> > > > > > Did anyone knows how to do that?
> > > > > >  
> > > > > > Flavio Magacho
> > > > > > Gerente de Desenvolvimento
> > > > > > Diretoria de Tecnologia da Informação
> > > > > > M4U
> > > > > > +55 (21) 2546-4050 ▪ Ramal: 4082
> > > > > > +55 (21) 8889-1572
> > > > > >  
> > > > > > þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
> > > > > > O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
> > > > > > The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
> > > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > Red Hat, Inc.
> > > > FuseSource is now part of Red Hat
> > > > Email: [hidden email] (mailto:[hidden email])
> > > > Web: http://fusesource.com
> > > > Twitter: davsclaus
> > > > Blog: http://davsclaus.com
> > > > Author of Camel in Action: http://www.manning.com/ibsen
> > >  
> > >  
> > >  
> > >  
> > >  
> > > --
> > > Claus Ibsen
> > > -----------------
> > > Red Hat, Inc.
> > > FuseSource is now part of Red Hat
> > > Email: [hidden email] (mailto:[hidden email])
> > > Web: http://fusesource.com
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> >  
> >  
> >  
> >  
> >  
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Email: [hidden email] (mailto:[hidden email])
> > Web: http://fusesource.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
>  
>  
>  
>  
>  
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email] (mailto:[hidden email])
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

flavio.magacho
In reply to this post by flavio.magacho
The idea is to use a development build. I'm building a release of camel-netty to test a code that claus have done. So how can I use this build in service mix?

Willem jiang <[hidden email]> wrote:


It's depends on what's version of service mix are you using.
As Apache Camel provides patch releases, it could be possible that you just replace the camel-netty or camel-mina jars with that latest one.


--
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang





On Tuesday, October 9, 2012 at 2:14 AM, Flavio Magacho - M4U wrote:

> Claus, I'm testing this case with Servicemmix, how can I change the camel Libs??
>
>
> -----Original Message-----
> From: Flavio Magacho - M4U [mailto:[hidden email]]
> Sent: segunda-feira, 8 de outubro de 2012 09:52
> To: [hidden email] (mailto:[hidden email])
> Subject: RE: Netty or Mina Async in the same socket
>
> Thank you Claus,
> I'll try the fix and tell you if it works.
>
> Talking about how I reproduced the problem:
> I open 2 telnet connections from different computers and I typed a sequence of 3 letters and an <Enter>, in computer A I typed a sequence of A's and in computer B I typed a sequence of B's.
> Doing this sometimes in computer A we have some B's and in the computer B we have also some A's.
>
> One again thank you.
> Flavio Magacho
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:[hidden email]]
> Sent: sábado, 6 de outubro de 2012 10:48
> To: [hidden email] (mailto:[hidden email])
> Subject: Re: Netty or Mina Async in the same socket
>
> On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email] (mailto:[hidden email])> wrote:
> > On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
> > <[hidden email] (mailto:[hidden email])> wrote:
> > > Claus, Thank you.
> > > It works, I think that I missed the transform tag :).
> > > I Simply set the body.
> > >
> > > But I got some concurrency problems.
> > > I opened 2 connections. . . and it mixes data between them.
> >
> >
> >
> > Ah yeah we should use an ordered thread pool that Netty offers. I
> > logged a ticket
> > https://issues.apache.org/jira/browse/CAMEL-5689
>
>
>
> I have committed a fix to trunk and 2.10 branch.
> I also added a concurrent test with 20 clients and they all get the expected reply.
>
> If you can try the latest code on trunk or 2.10 branch that would be good.
>
> And also how do you test it with the 2 connections? If there is still some issue, we would need a way to reproduce the issue.
>
> > > Is this component thread safe?
> > >
> > > Thank you!
> > > Magacho
> > >
> > >
> > > -----Original Message-----
> > > From: Claus Ibsen [mailto:[hidden email]]
> > > Sent: sexta-feira, 5 de outubro de 2012 12:15
> > > To: [hidden email] (mailto:[hidden email])
> > > Subject: Re: Netty or Mina Async in the same socket
> > >
> > > Hi
> > >
> > > I have added an unit test that does netty request/reply async and
> > > uses the same channel to write the response back
> > > http://svn.apache.org/viewvc?rev=1394556&view=rev
> > >
> > >
> > >
> > > On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email] (mailto:[hidden email])> wrote:
> > > > Ok Claus let me try to show you what I´m trying to do:
> > > >
> > > > <camelContext id="context-teste-claus" xmlns="http://camel.apache.org/schema/blueprint">
> > > > <route>
> > > > <from uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp;reuseAddress=true&amp;synchronous=false" />
> > > > <log message="reading ${bodyt}" />
> > > > <to uri="activemq:readQueue" />
> > > > </route>
> > > > <route>
> > > > <from uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurrentConsumers=10" />
> > > > <setBody>
> > > > <simple>Echo: ${body.text}!</simple>
> > > > </setBody>
> > > > <log message="Writing ${body}" />
> > > > <to uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&amp;reuseAddress=true&amp;synchronous=false" />
> > > > </route>
> > > > </camelContext>
> > > >
> > > > And I want to write in the same socket that the messages arrives.
> > > > The idea is to make the message exchange process to be Async.
> > > >
> > > > I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
> > > >
> > > > Thanks,
> > > > Magacho
> > > >
> > > > -----Original Message-----
> > > > From: Claus Ibsen [mailto:[hidden email]]
> > > > Sent: quinta-feira, 4 de outubro de 2012 03:30
> > > > To: [hidden email] (mailto:[hidden email])
> > > > Subject: Re: Netty or Mina Async in the same socket
> > > >
> > > > On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email] (mailto:[hidden email])> wrote:
> > > > > Hi Flavio,
> > > > >
> > > > > You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
> > > >
> > > > He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
> > > > And what triggers when this should happen.
> > > >
> > > > Maybe you can tell us a bit more about what you do in a Camel route eg?
> > > >
> > > > from netty?sync=false
> > > > to ???
> > > >
> > > > So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
> > > >
> > > >
> > > > > Chad Beaulac
> > > > > Objective Solutions, Inc.
> > > > > www.objectivesolutions.com (http://www.objectivesolutions.com)
> > > > > [hidden email] (mailto:[hidden email])
> > > > >
> > > > >
> > > > > On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
> > > > >
> > > > > > Hi,
> > > > > > My name is Flavio Magacho.
> > > > > > I have a specific problem:
> > > > > >
> > > > > > I´ll receive a socket connection and receive messages in this socket.
> > > > > > The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
> > > > > > I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
> > > > > >
> > > > > > Did anyone knows how to do that?
> > > > > >
> > > > > > Flavio Magacho
> > > > > > Gerente de Desenvolvimento
> > > > > > Diretoria de Tecnologia da Informação
> > > > > > M4U
> > > > > > +55 (21) 2546-4050 ▪ Ramal: 4082
> > > > > > +55 (21) 8889-1572
> > > > > >
> > > > > > þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
> > > > > > O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
> > > > > > The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > Red Hat, Inc.
> > > > FuseSource is now part of Red Hat
> > > > Email: [hidden email] (mailto:[hidden email])
> > > > Web: http://fusesource.com
> > > > Twitter: davsclaus
> > > > Blog: http://davsclaus.com
> > > > Author of Camel in Action: http://www.manning.com/ibsen
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > Red Hat, Inc.
> > > FuseSource is now part of Red Hat
> > > Email: [hidden email] (mailto:[hidden email])
> > > Web: http://fusesource.com
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> >
> >
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Email: [hidden email] (mailto:[hidden email])
> > Web: http://fusesource.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email] (mailto:[hidden email])
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



Reply | Threaded
Open this post in threaded view
|

RE: Netty or Mina Async in the same socket

flavio.magacho
Just for all to know, it works with my test case.
Thanks.
Magacho

-----Original Message-----
From: Flavio Magacho - M4U [mailto:[hidden email]]
Sent: terça-feira, 9 de outubro de 2012 07:08
To: [hidden email]
Subject: Re: Netty or Mina Async in the same socket

The idea is to use a development build. I'm building a release of camel-netty to test a code that claus have done. So how can I use this build in service mix?

Willem jiang <[hidden email]> wrote:


It's depends on what's version of service mix are you using.
As Apache Camel provides patch releases, it could be possible that you just replace the camel-netty or camel-mina jars with that latest one.


--
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang





On Tuesday, October 9, 2012 at 2:14 AM, Flavio Magacho - M4U wrote:

> Claus, I'm testing this case with Servicemmix, how can I change the camel Libs??
>
>
> -----Original Message-----
> From: Flavio Magacho - M4U [mailto:[hidden email]]
> Sent: segunda-feira, 8 de outubro de 2012 09:52
> To: [hidden email] (mailto:[hidden email])
> Subject: RE: Netty or Mina Async in the same socket
>
> Thank you Claus,
> I'll try the fix and tell you if it works.
>
> Talking about how I reproduced the problem:
> I open 2 telnet connections from different computers and I typed a sequence of 3 letters and an <Enter>, in computer A I typed a sequence of A's and in computer B I typed a sequence of B's.
> Doing this sometimes in computer A we have some B's and in the computer B we have also some A's.
>
> One again thank you.
> Flavio Magacho
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:[hidden email]]
> Sent: sábado, 6 de outubro de 2012 10:48
> To: [hidden email] (mailto:[hidden email])
> Subject: Re: Netty or Mina Async in the same socket
>
> On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email] (mailto:[hidden email])> wrote:
> > On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
> > <[hidden email] (mailto:[hidden email])> wrote:
> > > Claus, Thank you.
> > > It works, I think that I missed the transform tag :).
> > > I Simply set the body.
> > >
> > > But I got some concurrency problems.
> > > I opened 2 connections. . . and it mixes data between them.
> >
> >
> >
> > Ah yeah we should use an ordered thread pool that Netty offers. I
> > logged a ticket
> > https://issues.apache.org/jira/browse/CAMEL-5689
>
>
>
> I have committed a fix to trunk and 2.10 branch.
> I also added a concurrent test with 20 clients and they all get the expected reply.
>
> If you can try the latest code on trunk or 2.10 branch that would be good.
>
> And also how do you test it with the 2 connections? If there is still some issue, we would need a way to reproduce the issue.
>
> > > Is this component thread safe?
> > >
> > > Thank you!
> > > Magacho
> > >
> > >
> > > -----Original Message-----
> > > From: Claus Ibsen [mailto:[hidden email]]
> > > Sent: sexta-feira, 5 de outubro de 2012 12:15
> > > To: [hidden email] (mailto:[hidden email])
> > > Subject: Re: Netty or Mina Async in the same socket
> > >
> > > Hi
> > >
> > > I have added an unit test that does netty request/reply async and
> > > uses the same channel to write the response back
> > > http://svn.apache.org/viewvc?rev=1394556&view=rev
> > >
> > >
> > >
> > > On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email] (mailto:[hidden email])> wrote:
> > > > Ok Claus let me try to show you what I´m trying to do:
> > > >
> > > > <camelContext id="context-teste-claus"
> > > > xmlns="http://camel.apache.org/schema/blueprint">
> > > > <route>
> > > > <from
> > > > uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp
> > > > ;reuseAddress=true&amp;synchronous=false" /> <log
> > > > message="reading ${bodyt}" /> <to uri="activemq:readQueue" />
> > > > </route> <route> <from
> > > > uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurren
> > > > tConsumers=10" /> <setBody>
> > > > <simple>Echo: ${body.text}!</simple> </setBody> <log
> > > > message="Writing ${body}" /> <to
> > > > uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&am
> > > > p;reuseAddress=true&amp;synchronous=false" /> </route>
> > > > </camelContext>
> > > >
> > > > And I want to write in the same socket that the messages arrives.
> > > > The idea is to make the message exchange process to be Async.
> > > >
> > > > I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
> > > >
> > > > Thanks,
> > > > Magacho
> > > >
> > > > -----Original Message-----
> > > > From: Claus Ibsen [mailto:[hidden email]]
> > > > Sent: quinta-feira, 4 de outubro de 2012 03:30
> > > > To: [hidden email] (mailto:[hidden email])
> > > > Subject: Re: Netty or Mina Async in the same socket
> > > >
> > > > On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email] (mailto:[hidden email])> wrote:
> > > > > Hi Flavio,
> > > > >
> > > > > You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
> > > >
> > > > He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
> > > > And what triggers when this should happen.
> > > >
> > > > Maybe you can tell us a bit more about what you do in a Camel route eg?
> > > >
> > > > from netty?sync=false
> > > > to ???
> > > >
> > > > So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
> > > >
> > > >
> > > > > Chad Beaulac
> > > > > Objective Solutions, Inc.
> > > > > www.objectivesolutions.com (http://www.objectivesolutions.com)
> > > > > [hidden email]
> > > > > (mailto:[hidden email])
> > > > >
> > > > >
> > > > > On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
> > > > >
> > > > > > Hi,
> > > > > > My name is Flavio Magacho.
> > > > > > I have a specific problem:
> > > > > >
> > > > > > I´ll receive a socket connection and receive messages in this socket.
> > > > > > The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
> > > > > > I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
> > > > > >
> > > > > > Did anyone knows how to do that?
> > > > > >
> > > > > > Flavio Magacho
> > > > > > Gerente de Desenvolvimento
> > > > > > Diretoria de Tecnologia da Informação M4U
> > > > > > +55 (21) 2546-4050 ▪ Ramal: 4082
> > > > > > +55 (21) 8889-1572
> > > > > >
> > > > > > þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
> > > > > > O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
> > > > > > The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > Red Hat, Inc.
> > > > FuseSource is now part of Red Hat
> > > > Email: [hidden email] (mailto:[hidden email])
> > > > Web: http://fusesource.com
> > > > Twitter: davsclaus
> > > > Blog: http://davsclaus.com
> > > > Author of Camel in Action: http://www.manning.com/ibsen
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > Red Hat, Inc.
> > > FuseSource is now part of Red Hat
> > > Email: [hidden email] (mailto:[hidden email])
> > > Web: http://fusesource.com
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> >
> >
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Email: [hidden email] (mailto:[hidden email])
> > Web: http://fusesource.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email] (mailto:[hidden email])
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



Reply | Threaded
Open this post in threaded view
|

Re: Netty or Mina Async in the same socket

Claus Ibsen-2
On Tue, Oct 9, 2012 at 9:20 PM, Flavio Magacho - M4U
<[hidden email]> wrote:
> Just for all to know, it works with my test case.
> Thanks.
> Magacho
>

Thanks for testing and reporting back.


> -----Original Message-----
> From: Flavio Magacho - M4U [mailto:[hidden email]]
> Sent: terça-feira, 9 de outubro de 2012 07:08
> To: [hidden email]
> Subject: Re: Netty or Mina Async in the same socket
>
> The idea is to use a development build. I'm building a release of camel-netty to test a code that claus have done. So how can I use this build in service mix?
>
> Willem jiang <[hidden email]> wrote:
>
>
> It's depends on what's version of service mix are you using.
> As Apache Camel provides patch releases, it could be possible that you just replace the camel-netty or camel-mina jars with that latest one.
>
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>
>
>
>
>
> On Tuesday, October 9, 2012 at 2:14 AM, Flavio Magacho - M4U wrote:
>
>> Claus, I'm testing this case with Servicemmix, how can I change the camel Libs??
>>
>>
>> -----Original Message-----
>> From: Flavio Magacho - M4U [mailto:[hidden email]]
>> Sent: segunda-feira, 8 de outubro de 2012 09:52
>> To: [hidden email] (mailto:[hidden email])
>> Subject: RE: Netty or Mina Async in the same socket
>>
>> Thank you Claus,
>> I'll try the fix and tell you if it works.
>>
>> Talking about how I reproduced the problem:
>> I open 2 telnet connections from different computers and I typed a sequence of 3 letters and an <Enter>, in computer A I typed a sequence of A's and in computer B I typed a sequence of B's.
>> Doing this sometimes in computer A we have some B's and in the computer B we have also some A's.
>>
>> One again thank you.
>> Flavio Magacho
>>
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:[hidden email]]
>> Sent: sábado, 6 de outubro de 2012 10:48
>> To: [hidden email] (mailto:[hidden email])
>> Subject: Re: Netty or Mina Async in the same socket
>>
>> On Sat, Oct 6, 2012 at 11:23 AM, Claus Ibsen <[hidden email] (mailto:[hidden email])> wrote:
>> > On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
>> > <[hidden email] (mailto:[hidden email])> wrote:
>> > > Claus, Thank you.
>> > > It works, I think that I missed the transform tag :).
>> > > I Simply set the body.
>> > >
>> > > But I got some concurrency problems.
>> > > I opened 2 connections. . . and it mixes data between them.
>> >
>> >
>> >
>> > Ah yeah we should use an ordered thread pool that Netty offers. I
>> > logged a ticket
>> > https://issues.apache.org/jira/browse/CAMEL-5689
>>
>>
>>
>> I have committed a fix to trunk and 2.10 branch.
>> I also added a concurrent test with 20 clients and they all get the expected reply.
>>
>> If you can try the latest code on trunk or 2.10 branch that would be good.
>>
>> And also how do you test it with the 2 connections? If there is still some issue, we would need a way to reproduce the issue.
>>
>> > > Is this component thread safe?
>> > >
>> > > Thank you!
>> > > Magacho
>> > >
>> > >
>> > > -----Original Message-----
>> > > From: Claus Ibsen [mailto:[hidden email]]
>> > > Sent: sexta-feira, 5 de outubro de 2012 12:15
>> > > To: [hidden email] (mailto:[hidden email])
>> > > Subject: Re: Netty or Mina Async in the same socket
>> > >
>> > > Hi
>> > >
>> > > I have added an unit test that does netty request/reply async and
>> > > uses the same channel to write the response back
>> > > http://svn.apache.org/viewvc?rev=1394556&view=rev
>> > >
>> > >
>> > >
>> > > On Thu, Oct 4, 2012 at 3:03 PM, Flavio Magacho - M4U <[hidden email] (mailto:[hidden email])> wrote:
>> > > > Ok Claus let me try to show you what I´m trying to do:
>> > > >
>> > > > <camelContext id="context-teste-claus"
>> > > > xmlns="http://camel.apache.org/schema/blueprint">
>> > > > <route>
>> > > > <from
>> > > > uri="netty:tcp://localhost:10022?textline=true&amp;sync=true&amp
>> > > > ;reuseAddress=true&amp;synchronous=false" /> <log
>> > > > message="reading ${bodyt}" /> <to uri="activemq:readQueue" />
>> > > > </route> <route> <from
>> > > > uri="activemq:writeQueue?concurrentConsumers=10&amp;maxConcurren
>> > > > tConsumers=10" /> <setBody>
>> > > > <simple>Echo: ${body.text}!</simple> </setBody> <log
>> > > > message="Writing ${body}" /> <to
>> > > > uri="netty:tcp://localhost:10022?textline=true&amp;sync=false&am
>> > > > p;reuseAddress=true&amp;synchronous=false" /> </route>
>> > > > </camelContext>
>> > > >
>> > > > And I want to write in the same socket that the messages arrives.
>> > > > The idea is to make the message exchange process to be Async.
>> > > >
>> > > > I tried to use the Headers that you said, but they are not Serializable, so I´ll need to write an endpoint based on the camel-netty and keep a hashmap with the channel and a channel identifier as a key. I Should write this identifier in the message properties and then, when it comes back, I´ll be able to write it back in the same socket. Does it Makes sense to you?
>> > > >
>> > > > Thanks,
>> > > > Magacho
>> > > >
>> > > > -----Original Message-----
>> > > > From: Claus Ibsen [mailto:[hidden email]]
>> > > > Sent: quinta-feira, 4 de outubro de 2012 03:30
>> > > > To: [hidden email] (mailto:[hidden email])
>> > > > Subject: Re: Netty or Mina Async in the same socket
>> > > >
>> > > > On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <[hidden email] (mailto:[hidden email])> wrote:
>> > > > > Hi Flavio,
>> > > > >
>> > > > > You can't do what you're asking for using camel-mina or camel-mina2 at this point in time.
>> > > >
>> > > > He can grab the netty channel as its enriched on the message as a header. Then use that channel to write the 2nd message back. He would need to code that. Its a matter though where and when the 2nd message should be send back.
>> > > > And what triggers when this should happen.
>> > > >
>> > > > Maybe you can tell us a bit more about what you do in a Camel route eg?
>> > > >
>> > > > from netty?sync=false
>> > > > to ???
>> > > >
>> > > > So you want at ?? something to process the incoming message, and use the same socket to send back a reply message?
>> > > >
>> > > >
>> > > > > Chad Beaulac
>> > > > > Objective Solutions, Inc.
>> > > > > www.objectivesolutions.com (http://www.objectivesolutions.com)
>> > > > > [hidden email]
>> > > > > (mailto:[hidden email])
>> > > > >
>> > > > >
>> > > > > On Oct 3, 2012, at 9:35 AM, Flavio Magacho - M4U wrote:
>> > > > >
>> > > > > > Hi,
>> > > > > > My name is Flavio Magacho.
>> > > > > > I have a specific problem:
>> > > > > >
>> > > > > > I´ll receive a socket connection and receive messages in this socket.
>> > > > > > The point is to answer the messages, they should be send by the same socket and we can’t use the sync option.
>> > > > > > I tried to use Mina and Netty The only way I got to answer in the same socket is to use the Sync option.
>> > > > > >
>> > > > > > Did anyone knows how to do that?
>> > > > > >
>> > > > > > Flavio Magacho
>> > > > > > Gerente de Desenvolvimento
>> > > > > > Diretoria de Tecnologia da Informação M4U
>> > > > > > +55 (21) 2546-4050 ▪ Ramal: 4082
>> > > > > > +55 (21) 8889-1572
>> > > > > >
>> > > > > > þ Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio Ambiente.
>> > > > > > O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a sua cópia ou divulgação.
>> > > > > > The contents of this message are confidential and may be privileged. Copying or disclosing is prohibited.
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > Claus Ibsen
>> > > > -----------------
>> > > > Red Hat, Inc.
>> > > > FuseSource is now part of Red Hat
>> > > > Email: [hidden email] (mailto:[hidden email])
>> > > > Web: http://fusesource.com
>> > > > Twitter: davsclaus
>> > > > Blog: http://davsclaus.com
>> > > > Author of Camel in Action: http://www.manning.com/ibsen
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > Claus Ibsen
>> > > -----------------
>> > > Red Hat, Inc.
>> > > FuseSource is now part of Red Hat
>> > > Email: [hidden email] (mailto:[hidden email])
>> > > Web: http://fusesource.com
>> > > Twitter: davsclaus
>> > > Blog: http://davsclaus.com
>> > > Author of Camel in Action: http://www.manning.com/ibsen
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Claus Ibsen
>> > -----------------
>> > Red Hat, Inc.
>> > FuseSource is now part of Red Hat
>> > Email: [hidden email] (mailto:[hidden email])
>> > Web: http://fusesource.com
>> > Twitter: davsclaus
>> > Blog: http://davsclaus.com
>> > Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: [hidden email] (mailto:[hidden email])
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>
>
>



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen