You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gareth Collins <ga...@hotmail.com> on 2010/04/07 18:21:26 UTC

New Suggested Feature For Mina/Netty

Hello,

In looking at the source for Netty/Mina, I see that it is assumed that if a
consumer is desired a listener port is created, whilst if a producer is
desired a client is created.

Would it be possible in a subsequent release to relax this restriction (i.e.
allowing a consumer to be a client, a producer to be a server)?

I ask this as I have a requirement to connect to a third-party server
periodically to retrieve any outstanding messages. If the server has any
outstanding messages it sends them immediately (without me sending any
data). When all messages have been sent, the server closes the connection.
For now, I will create a custom component for this. However, it would be
nice if I could implement this using the generic mina/netty components.

thanks in advance,
Gareth Collins
-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28167370.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: New Suggested Feature For Mina/Netty

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

Could you add suggestions and request for new features in the Camel Jira
https://issues.apache.org/activemq/secure/Dashboard.jspa
https://issues.apache.org/activemq/secure/Dashboard.jspa 

This way it can be tracked and used to improve camel capabilities in days to
come.

Thanks and keep the recommendations coming.

Cheers,

Ashwin...  

Gareth Collins wrote:
> 
> Hello,
> 
> In looking at the source for Netty/Mina, I see that it is assumed that if
> a consumer is desired a listener port is created, whilst if a producer is
> desired a client is created.
> 
> Would it be possible in a subsequent release to relax this restriction
> (i.e. allowing a consumer to be a client, a producer to be a server)?
> 
> I ask this as I have a requirement to connect to a third-party server
> periodically to retrieve any outstanding messages. If the server has any
> outstanding messages it sends them immediately (without me sending any
> data). When all messages have been sent, the server closes the connection.
> For now, I will create a custom component for this. However, it would be
> nice if I could implement this using the generic mina/netty components.
> 
> thanks in advance,
> Gareth Collins
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28187480.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: New Suggested Feature For Mina/Netty

Posted by anandsk <sk...@arccorp.com>.
I have added improvement request for this feature. you may want to add
comments for your specific needs if they are different.
https://issues.apache.org/activemq/browse/CAMEL-2624


anandsk wrote:
> 
> I have a similar requirement but only difference is I do have a message to
> send but I expect replies in asyncronous fashion. so I would vote for
> suggested feature.
> 
> Though it is not elegant I am thinking of using this solution for now, may
> be it will work for you also and just send a blank message.
> 
> may be you can have a timer consumer instead of file below.
> 
>                 from("file:///test/test/response") 
>                 .convertBodyTo(String.class).threads(1) 
>                
> .to("mina:tcp://localhost:6202?sync=false&textline=true&filters=#listFilters"); 
>                 
>                 from("vm:response") 
>                 .to("log:+++ reply++++"); 
> 
> public class MessageFilter extends IoFilterAdapter { 
>     @Produce(uri = "vm:response") 
>     ProducerTemplate producer; 
>             @Override 
>             public void messageReceived(NextFilter nextFilter, IoSession
> session, 
>                     Object message) throws Exception { 
>                 if (message instanceof String) { 
>                 producer.sendBody(message); 
>                     } 
>                 
>                 nextFilter.messageReceived(session, message); 
>             } 
>         
> } 
> 
> 
> Gareth Collins wrote:
>> 
>> Hello,
>> 
>> In looking at the source for Netty/Mina, I see that it is assumed that if
>> a consumer is desired a listener port is created, whilst if a producer is
>> desired a client is created.
>> 
>> Would it be possible in a subsequent release to relax this restriction
>> (i.e. allowing a consumer to be a client, a producer to be a server)?
>> 
>> I ask this as I have a requirement to connect to a third-party server
>> periodically to retrieve any outstanding messages. If the server has any
>> outstanding messages it sends them immediately (without me sending any
>> data). When all messages have been sent, the server closes the
>> connection. For now, I will create a custom component for this. However,
>> it would be nice if I could implement this using the generic mina/netty
>> components.
>> 
>> thanks in advance,
>> Gareth Collins
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28178835.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: New Suggested Feature For Mina/Netty

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


anandsk wrote:
> 
> I have a similar requirement but only difference is I do have a message to
> send but I expect async replies. so I would vote for suggested feature.
> 
> Though it is not elegant I am thinking of using this solution for now, may
> be it will work for you also and just send a blank message.
> 
> may be you can have a timer consumer instead of file below.
> 
>                 from("file:///test/test/response") 
>                 .convertBodyTo(String.class).threads(1) 
>                
> .to("mina:tcp://localhost:6202?sync=false&textline=true&filters=#listFilters"); 
>                 
>                 from("vm:response") 
>                 .to("log:+++ reply++++"); 
> 
> public class MessageFilter extends IoFilterAdapter { 
>     @Produce(uri = "vm:response") 
>     ProducerTemplate producer; 
>             @Override 
>             public void messageReceived(NextFilter nextFilter, IoSession
> session, 
>                     Object message) throws Exception { 
>                 if (message instanceof String) { 
>                 producer.sendBody(message); 
>                     } 
>                 
>                 nextFilter.messageReceived(session, message); 
>             } 
>         
> } 
> 
> 
> Gareth Collins wrote:
>> 
>> Hello,
>> 
>> In looking at the source for Netty/Mina, I see that it is assumed that if
>> a consumer is desired a listener port is created, whilst if a producer is
>> desired a client is created.
>> 
>> Would it be possible in a subsequent release to relax this restriction
>> (i.e. allowing a consumer to be a client, a producer to be a server)?
>> 
>> I ask this as I have a requirement to connect to a third-party server
>> periodically to retrieve any outstanding messages. If the server has any
>> outstanding messages it sends them immediately (without me sending any
>> data). When all messages have been sent, the server closes the
>> connection. For now, I will create a custom component for this. However,
>> it would be nice if I could implement this using the generic mina/netty
>> components.
>> 
>> thanks in advance,
>> Gareth Collins
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28168088.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: New Suggested Feature For Mina/Netty

Posted by anandsk <sk...@arccorp.com>.
I think Mina(not camel-mina) has a background thread for receiving messages.
you can try it out and see  whether you get multiple messages using a simple
route.


Gareth Collins wrote:
> 
> Thanks for the response.
> 
> I considered what you suggested. I didn't know how to deal with multiple
> response messages per request though (I has understood that camel
> mina/netty components only supported "one request - one response").
> 
> thanks,
> Gareth
> 
> 
> anandsk wrote:
>> 
>> I have a similar requirement but only difference is I do have a message
>> to send but I expect replies in asyncronous fashion. so I would vote for
>> suggested feature.
>> 
>> Though it is not elegant I am thinking of using this solution for now,
>> may be it will work for you also and just send a blank message.
>> 
>> may be you can have a timer consumer instead of file below.
>> 
>>                 from("file:///test/test/response") 
>>                 .convertBodyTo(String.class).threads(1) 
>>                
>> .to("mina:tcp://localhost:6202?sync=false&textline=true&filters=#listFilters"); 
>>                 
>>                 from("vm:response") 
>>                 .to("log:+++ reply++++"); 
>> 
>> public class MessageFilter extends IoFilterAdapter { 
>>     @Produce(uri = "vm:response") 
>>     ProducerTemplate producer; 
>>             @Override 
>>             public void messageReceived(NextFilter nextFilter, IoSession
>> session, 
>>                     Object message) throws Exception { 
>>                 if (message instanceof String) { 
>>                 producer.sendBody(message); 
>>                     } 
>>                 
>>                 nextFilter.messageReceived(session, message); 
>>             } 
>>         
>> } 
>> 
>> 
>> Gareth Collins wrote:
>>> 
>>> Hello,
>>> 
>>> In looking at the source for Netty/Mina, I see that it is assumed that
>>> if a consumer is desired a listener port is created, whilst if a
>>> producer is desired a client is created.
>>> 
>>> Would it be possible in a subsequent release to relax this restriction
>>> (i.e. allowing a consumer to be a client, a producer to be a server)?
>>> 
>>> I ask this as I have a requirement to connect to a third-party server
>>> periodically to retrieve any outstanding messages. If the server has any
>>> outstanding messages it sends them immediately (without me sending any
>>> data). When all messages have been sent, the server closes the
>>> connection. For now, I will create a custom component for this. However,
>>> it would be nice if I could implement this using the generic mina/netty
>>> components.
>>> 
>>> thanks in advance,
>>> Gareth Collins
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28169091.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: New Suggested Feature For Mina/Netty

Posted by Gareth Collins <ga...@hotmail.com>.
Thanks for the response.

I considered what you suggested. I didn't know how to deal with multiple
response messages per request though (I has understood that camel mina/netty
components only supported "one request - one response").

thanks,
Gareth


anandsk wrote:
> 
> I have a similar requirement but only difference is I do have a message to
> send but I expect replies in asyncronous fashion. so I would vote for
> suggested feature.
> 
> Though it is not elegant I am thinking of using this solution for now, may
> be it will work for you also and just send a blank message.
> 
> may be you can have a timer consumer instead of file below.
> 
>                 from("file:///test/test/response") 
>                 .convertBodyTo(String.class).threads(1) 
>                
> .to("mina:tcp://localhost:6202?sync=false&textline=true&filters=#listFilters"); 
>                 
>                 from("vm:response") 
>                 .to("log:+++ reply++++"); 
> 
> public class MessageFilter extends IoFilterAdapter { 
>     @Produce(uri = "vm:response") 
>     ProducerTemplate producer; 
>             @Override 
>             public void messageReceived(NextFilter nextFilter, IoSession
> session, 
>                     Object message) throws Exception { 
>                 if (message instanceof String) { 
>                 producer.sendBody(message); 
>                     } 
>                 
>                 nextFilter.messageReceived(session, message); 
>             } 
>         
> } 
> 
> 
> Gareth Collins wrote:
>> 
>> Hello,
>> 
>> In looking at the source for Netty/Mina, I see that it is assumed that if
>> a consumer is desired a listener port is created, whilst if a producer is
>> desired a client is created.
>> 
>> Would it be possible in a subsequent release to relax this restriction
>> (i.e. allowing a consumer to be a client, a producer to be a server)?
>> 
>> I ask this as I have a requirement to connect to a third-party server
>> periodically to retrieve any outstanding messages. If the server has any
>> outstanding messages it sends them immediately (without me sending any
>> data). When all messages have been sent, the server closes the
>> connection. For now, I will create a custom component for this. However,
>> it would be nice if I could implement this using the generic mina/netty
>> components.
>> 
>> thanks in advance,
>> Gareth Collins
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28168916.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: New Suggested Feature For Mina/Netty

Posted by anandsk <sk...@arccorp.com>.
I have a similar requirement but only difference is I do have a message to
send but I expect replies in asyncronous fashion. so I would vote for
suggested feature.

Though it is not elegant I am thinking of using this solution for now, may
be it will work for you also and just send a blank message.

may be you can have a timer consumer instead of file below.

                from("file:///test/test/response") 
                .convertBodyTo(String.class).threads(1) 
               
.to("mina:tcp://localhost:6202?sync=false&textline=true&filters=#listFilters"); 
                
                from("vm:response") 
                .to("log:+++ reply++++"); 

public class MessageFilter extends IoFilterAdapter { 
    @Produce(uri = "vm:response") 
    ProducerTemplate producer; 
            @Override 
            public void messageReceived(NextFilter nextFilter, IoSession
session, 
                    Object message) throws Exception { 
                if (message instanceof String) { 
                producer.sendBody(message); 
                    } 
                
                nextFilter.messageReceived(session, message); 
            } 
        
} 


Gareth Collins wrote:
> 
> Hello,
> 
> In looking at the source for Netty/Mina, I see that it is assumed that if
> a consumer is desired a listener port is created, whilst if a producer is
> desired a client is created.
> 
> Would it be possible in a subsequent release to relax this restriction
> (i.e. allowing a consumer to be a client, a producer to be a server)?
> 
> I ask this as I have a requirement to connect to a third-party server
> periodically to retrieve any outstanding messages. If the server has any
> outstanding messages it sends them immediately (without me sending any
> data). When all messages have been sent, the server closes the connection.
> For now, I will create a custom component for this. However, it would be
> nice if I could implement this using the generic mina/netty components.
> 
> thanks in advance,
> Gareth Collins
> 

-- 
View this message in context: http://old.nabble.com/New-Suggested-Feature-For-Mina-Netty-tp28167370p28167770.html
Sent from the Camel - Users mailing list archive at Nabble.com.