camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Message-dependent sync with MINA?
Date Mon, 30 Jan 2012 13:33:28 GMT
On Fri, Jan 27, 2012 at 4:32 PM, andlu702 <> wrote:
> Hi
> I have a situation where I am to replace a legacy server which has multiple
> clients and the communication is with a custom raw-byte format over TCP.
> I was thinking that camel MINA must be perfect for the task and have written
> a codec to encode and decode the messages.
> However, the communication between the clients and server is mostly of type
> "fire and forget", where the client do not wait for an answer but some
> messages require a response. This means that neither the option sync=true
> nor sync=false will suffice. The clients do not have the option to connect
> to a certain port if an answer is required and another port if they require
> no answer. Therefore I must implement a server which, based on the message
> received, will return an answer or not return an answer.
> My question is if this is possible using the camel MINA component?
> I've made some experiments (JUnit tests) trying to change the
> ExchangePattern in a route from a MINA endpoint with sync=true with
> setExchangePattern(ExchangePattern.InOnly). By the looks of the printouts
> from the minaLogger that doesn't do anything and the request message to the
> endpoint is the same as the response to the client.
> The silver bullet for me would be an option like "sync=messageDependent" and
> in my implementation of ProtocolDecoder had the option to tell the MINA
> component whether to keep the connection open for reply or not.

You can set a header on the message to tell camel-mina whether to
disconnect the connection after use.
And I think if you set an empty/null body then it may detect this and
do not send back a reply. Check the source code.

> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message