Claus Ibsen a écrit :
On Fri, Mar 12, 2010 at 2:09 PM, Nicolas Bouillon <nico...@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
smime.p7s
Description: S/MIME Cryptographic Signature