You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Muhammad Ichsan <ic...@gmail.com> on 2010/04/01 07:56:55 UTC

Mina endpoint behaviour

Dear All,

I tried to use mina endpoints. I see that mina endpoints which is used
in <from> will act as servers and the ones which is used in <to> will
act as clients.

Actually, I need mina endpoints which more or less defined as the
following code:

<from uri="mina:tcp://localhost?as_server=false"><!-- act as client .
This endpoint connects to a server -->
<to uri="processData">
<to uri="mina:tcp://localhost?as_server=false"><!-- return the result
using THE SAME socket -->

Is it possible?

Thanks!

-- 
~The best men are men who benefit to others
http://michsan.web.id

Yang berkualitas memang beda rasanya!
http://rizqi-cookies.com

Re: Mina endpoint behaviour

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Apr 2, 2010 at 7:02 AM, Muhammad Ichsan <ic...@gmail.com> wrote:
> On Fri, Apr 2, 2010 at 2:47 AM, Ashwin Karpe <as...@progress.com> wrote:
>>
>> Hi,
>>
>> Yes, they will connect to each other since the URL points to the same host
>> and port over TCP.
>
> There is no point doing this. There is a never ending loop when doing
> this. I've tried myself.

Remove the last <to/> and it will send back the result since the from
has sync=true option.



>
>                <route>
>                        <from uri="mina:tcp://localhost:2236?textline=true&amp;sync=true"
> /><!-- As Server -->
>                        <to uri="bean:textUtil?method=reverse" />
>                        <to uri="bean:printer?method=print" />
>                        <to uri="mina:tcp://localhost:2236?textline=true&amp;sync=true"
> /><!-- send the result back to server -->
>                </route>
>
>
> --
> ~The best men are men who benefit to others
> http://michsan.web.id
>
> Yang berkualitas memang beda rasanya!
> http://rizqi-cookies.com
>



-- 
Claus Ibsen
Apache Camel Committer

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

Re: Mina endpoint behaviour

Posted by Muhammad Ichsan <ic...@gmail.com>.
On Fri, Apr 2, 2010 at 2:47 AM, Ashwin Karpe <as...@progress.com> wrote:
>
> Hi,
>
> Yes, they will connect to each other since the URL points to the same host
> and port over TCP.

There is no point doing this. There is a never ending loop when doing
this. I've tried myself.

		<route>
			<from uri="mina:tcp://localhost:2236?textline=true&amp;sync=true"
/><!-- As Server -->
			<to uri="bean:textUtil?method=reverse" />
			<to uri="bean:printer?method=print" />
			<to uri="mina:tcp://localhost:2236?textline=true&amp;sync=true"
/><!-- send the result back to server -->
		</route>
		

-- 
~The best men are men who benefit to others
http://michsan.web.id

Yang berkualitas memang beda rasanya!
http://rizqi-cookies.com

Re: Mina endpoint behaviour

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

Yes, they will connecto eac other since the URL points to the same host and
port over TCP.

Cheers,

Ashwin...



Muhammad Ichsan wrote:
> 
> On Thu, Apr 1, 2010 at 7:13 PM, Ashwin Karpe <as...@progress.com> wrote:
>>
>> Hi,
>>
>> You cannot do it the way you have detailed. The endpoint in the from()
>> clause will create a TCP Listener and bind to a socket (aka server).
>>
>> You could do the following and accomplish your objective
>>
>> In Client
>> ----------
>>    from (...)
>>       .to(mina:tcp://localhost:5000?sync=true")                // Client
>>       .to("bean:processResponse");
>>
>> In Server
>> ----------
>>    from(mina:tcp://localhost:5000?sync=true")              // Server
>>       .to("bean:processData");
> 
> I think the routes above will connect each other, won't they? The
> first to(mina) will connect to from(mina)
> 
> 
> -- 
> ~The best men are men who benefit to others
> http://michsan.web.id
> 
> 


-----
--- 
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/Mina-endpoint-behaviour-tp28104796p28112840.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Mina endpoint behaviour

Posted by Muhammad Ichsan <ic...@gmail.com>.
On Thu, Apr 1, 2010 at 7:13 PM, Ashwin Karpe <as...@progress.com> wrote:
>
> Hi,
>
> You cannot do it the way you have detailed. The endpoint in the from()
> clause will create a TCP Listener and bind to a socket (aka server).
>
> You could do the following and accomplish your objective
>
> In Client
> ----------
>    from (...)
>       .to(mina:tcp://localhost:5000?sync=true")                // Client
>       .to("bean:processResponse");
>
> In Server
> ----------
>    from(mina:tcp://localhost:5000?sync=true")              // Server
>       .to("bean:processData");

I think the routes above will connect each other, won't they? The
first to(mina) will connect to from(mina)


-- 
~The best men are men who benefit to others
http://michsan.web.id

Re: Mina endpoint behaviour

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

You cannot do it the way you have detailed. The endpoint in the from()
clause will create a TCP Listener and bind to a socket (aka server).

You could do the following and accomplish your objective

In Client
----------
    from (...)
       .to(mina:tcp://localhost:5000?sync=true")                // Client
       .to("bean:processResponse");

In Server
----------
    from(mina:tcp://localhost:5000?sync=true")              // Server
       .to("bean:processData");
    
Hope this helps.

Cheers,

Ashwin...

Muhammad Ichsan wrote:
> 
> Dear All,
> 
> I tried to use mina endpoints. I see that mina endpoints which is used
> in <from> will act as servers and the ones which is used in <to> will
> act as clients.
> 
> Actually, I need mina endpoints which more or less defined as the
> following code:
> 
> <from uri="mina:tcp://localhost?as_server=false"><!-- act as client .
> This endpoint connects to a server -->
> <to uri="processData">
> <to uri="mina:tcp://localhost?as_server=false"><!-- return the result
> using THE SAME socket -->
> 
> Is it possible?
> 
> Thanks!
> 
> -- 
> ~The best men are men who benefit to others
> http://michsan.web.id
> 
> Yang berkualitas memang beda rasanya!
> http://rizqi-cookies.com
> 
> 


-----
--- 
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/Mina-endpoint-behaviour-tp28104796p28107778.html
Sent from the Camel - Users mailing list archive at Nabble.com.