You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nicolas Bouillon <ni...@bouil.org> on 2010/03/12 14:09:49 UTC
Odd Mina endpoint use
Hello,
I have a odd Camel Mina endpoint scenario than I don't know how to do, or
even if it is possible.
I would like to have a TCP server : client can send request at any time,
and server can initiate at any time a message to the client. As far i know,
we can only do with Camel-Mina a request only scenario (if mina sync=false)
or a 1 request / 1 reply (if mina sync=true).
I hope I'm clear enough...
Thanks.
Nicolas.
Re: Odd Mina endpoint use
Posted by Ashwin Karpe <as...@progress.com>.
Hi,
Can this not be coded as 2 one-way interactions (sync=false) with the server
sending a response to a different socket (with a correlation id)...
Alternatively, I am sure if this has to be request/reply (to a given point)
you could also increase the connection keepAlive to ensure that the
connection does not close or timeout... Not ideal, of course.
Cheers,
Ashwin...
bouil wrote:
>
> Hello,
>
> I have a odd Camel Mina endpoint scenario than I don't know how to do, or
> even if it is possible.
>
> I would like to have a TCP server : client can send request at any time,
> and server can initiate at any time a message to the client. As far i
> know,
> we can only do with Camel-Mina a request only scenario (if mina
> sync=false)
> or a 1 request / 1 reply (if mina sync=true).
>
> I hope I'm clear enough...
>
> Thanks.
> Nicolas.
>
>
>
-----
---
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/Odd-Mina-endpoint-use-tp27877265p27901727.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Odd Mina endpoint use
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
If you want request/reply then just set the reply message and then end
the route, as it will then send back the reply.
Use sync=true to indicate request/reply
<route>
<from uri="minaEnpointClient?sync=true" />
<!-- set the reply message here -->
</route>
On Fri, Mar 12, 2010 at 6:50 PM, Nicolas Bouillon <ni...@bouil.org> wrote:
> Claus Ibsen a écrit :
>>
>> On Fri, Mar 12, 2010 at 2:09 PM, Nicolas Bouillon <ni...@bouil.org>
>> wrote:
>>
>>>
>>> Hello,
>>>
>>> I have a odd Camel Mina endpoint scenario than I don't know how to do, or
>>> even if it is possible.
>>>
>>> I would like to have a TCP server : client can send request at any time,
>>> and server can initiate at any time a message to the client. As far i
>>> know,
>>> we can only do with Camel-Mina a request only scenario (if mina
>>> sync=false)
>>> or a 1 request / 1 reply (if mina sync=true).
>>>
>>> I hope I'm clear enough...
>>>
>>>
>>
>> Yeah that sounds possible.
>>
>> fire and forget
>> and
>> request/reply
>>
>> over MINA should be possible.
>>
>> Just that the TCP ports is open so you can send to the "other" party.
>> And that you have a port open, so the "other" party can send to you.
>>
>
> Yes, i think it should be possible. But does the current Camel-Mina
> implementation can allow that ? I've tried something like this :
>
> <camel:camelContext id="camel"
> xmlns="http://camel.apache.org/schema/spring">
>
> <route>
> <from uri="minaEnpointClient" />
> <to uri="direct:write" />
> </route>
> <route>
> <from uri="direct:read" />
> <to uri="minaEnpointClient" />
> </route>
>
> </camel:camelContext>
>
> <bean id="myMinaFactory"
> class="org.apache.camel.component.mina.MinaComponent">
> <constructor-arg index="0" ref="camel" />
> </bean>
>
> <bean id="minaEnpointClient" factory-bean="myMinaFactory"
> factory-method="createEndpoint">
> <constructor-arg index="0" ref="myMinaConfigClient" />
> </bean>
>
> <bean id="myMinaConfigClient"
> class="org.apache.camel.component.mina.MinaConfiguration">
> <property name="protocol" value="tcp" />
> <property name="host" value="localhost" />
> <property name="port" value="1234" />
> </bean>
>
> and myMinaEndPoint defined with a bean and MinaComponent as a endpoint
> factory.
>
> Obviously, it doesn't work, because when used as "to", the mina endpoint is
> a new connection to... myself, not a send data to the already connected
> user.
>
> I'm ready to implement some pieces in camel-mina component, but I don't see
> yet how it could be done. Specially how to have session tracking, ie to
> reach a specific client connection when sending some data as the server
> initiative.
>
> Nicolas
>
>
--
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: Odd Mina endpoint use
Posted by Nicolas Bouillon <ni...@bouil.org>.
Claus Ibsen a écrit :
> On Fri, Mar 12, 2010 at 2:09 PM, Nicolas Bouillon <ni...@bouil.org> wrote:
>
>> Hello,
>>
>> I have a odd Camel Mina endpoint scenario than I don't know how to do, or
>> even if it is possible.
>>
>> I would like to have a TCP server : client can send request at any time,
>> and server can initiate at any time a message to the client. As far i know,
>> we can only do with Camel-Mina a request only scenario (if mina sync=false)
>> or a 1 request / 1 reply (if mina sync=true).
>>
>> I hope I'm clear enough...
>>
>>
>
> Yeah that sounds possible.
>
> fire and forget
> and
> request/reply
>
> over MINA should be possible.
>
> Just that the TCP ports is open so you can send to the "other" party.
> And that you have a port open, so the "other" party can send to you.
>
Yes, i think it should be possible. But does the current Camel-Mina
implementation can allow that ? I've tried something like this :
<camel:camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="minaEnpointClient" />
<to uri="direct:write" />
</route>
<route>
<from uri="direct:read" />
<to uri="minaEnpointClient" />
</route>
</camel:camelContext>
<bean id="myMinaFactory"
class="org.apache.camel.component.mina.MinaComponent">
<constructor-arg index="0" ref="camel" />
</bean>
<bean id="minaEnpointClient" factory-bean="myMinaFactory"
factory-method="createEndpoint">
<constructor-arg index="0" ref="myMinaConfigClient" />
</bean>
<bean id="myMinaConfigClient"
class="org.apache.camel.component.mina.MinaConfiguration">
<property name="protocol" value="tcp" />
<property name="host" value="localhost" />
<property name="port" value="1234" />
</bean>
and myMinaEndPoint defined with a bean and MinaComponent as a endpoint
factory.
Obviously, it doesn't work, because when used as "to", the mina endpoint
is a new connection to... myself, not a send data to the already
connected user.
I'm ready to implement some pieces in camel-mina component, but I don't
see yet how it could be done. Specially how to have session tracking, ie
to reach a specific client connection when sending some data as the
server initiative.
Nicolas
Re: Odd Mina endpoint use
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 12, 2010 at 2:09 PM, Nicolas Bouillon <ni...@bouil.org> wrote:
> Hello,
>
> I have a odd Camel Mina endpoint scenario than I don't know how to do, or
> even if it is possible.
>
> I would like to have a TCP server : client can send request at any time,
> and server can initiate at any time a message to the client. As far i know,
> we can only do with Camel-Mina a request only scenario (if mina sync=false)
> or a 1 request / 1 reply (if mina sync=true).
>
> I hope I'm clear enough...
>
Yeah that sounds possible.
fire and forget
and
request/reply
over MINA should be possible.
Just that the TCP ports is open so you can send to the "other" party.
And that you have a port open, so the "other" party can send to you.
> Thanks.
> Nicolas.
>
>
--
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