camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Netty or Mina Async in the same socket
Date Sat, 06 Oct 2012 09:23:52 GMT
On Fri, Oct 5, 2012 at 7:55 PM, Flavio Magacho - M4U
<flavio.magacho@m4u.com.br> 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:claus.ibsen@gmail.com]
> Sent: sexta-feira, 5 de outubro de 2012 12:15
> To: users@camel.apache.org
> 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 <flavio.magacho@m4u.com.br>
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:claus.ibsen@gmail.com]
>> Sent: quinta-feira, 4 de outubro de 2012 03:30
>> To: users@camel.apache.org
>> Subject: Re: Netty or Mina Async in the same socket
>>
>> On Thu, Oct 4, 2012 at 12:54 AM, Chad Beaulac <cabeaulac@gmail.com> 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
>>> chad@objectivesolutions.com
>>>
>>>
>>> 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: cibsen@redhat.com
>> 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: cibsen@redhat.com
> 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: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message