I am trying to build a prototype using Apache Camel-Mina2 component. We have
our own protocol implementation on TCP and I need to intercept Client -
Server messages using a proxy Component. Existing - TCP Client ----> TCP
Server

New - TCP Client ----> Proxy Server -----> TCP Server

One of the issue in our protocol is that each Request is not guaranteed a
reply from the server, so some requests will be sent on the channel with an
optional response. However some requests will also get back a response.

Protocol Semantics : Hi ----> <---- Hello How Are You ------> Are You okay
-----> <-----Yes

As you can see messages with ----> are from client to server and <---- are
responses from Server ( on a single stream /line).

Now given the above problem, Camel-Mina2 works on a InOut message exchange
pattern. The ExchangePattern Enumeration also has an InOptionalOut use case.

Any suggestions how I can configure my endpoints? I  would like to know if
it is possible to make use of an InOptionalOut exchange pattern. So
essentially not worry about the response for certain types of messages. Can
I handle this programmatically - Read the Message Body and decide if a
Request needs a Response or just needs to be written out  ? 

Sample implementation is as below:

SimpleRegistry reg = new SimpleRegistry();
        reg.put("ProtocolCodec", new ProtocolCodec());
        CamelContext context = new DefaultCamelContext(reg);

        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                // TODO Auto-generated method stub
               
from("mina2:tcp://localhost:9888?sync=true&codec=#ProtocolCodec&disconnectOnNoReply=false").
               
to("mina2:tcp://localhost:9889?sync=true&codec=#ProtocolCodec&disconnectOnNoReply=false&clientMode=true");

            }
        }); 

        context.start();





--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-Mina2-ExchangePattern-tp5765184.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to