THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Wiki Markup |
---|
{snippet:id=e2|lang=xml|url=camel/trunk/components/camel-mina/src/test/resources/org/apache/camel/component/mina/SpringMinaEndpointTest-context.xml} |
Closing Session When Complete
Avaiable as of Camel 1.6.1
When acting as a server you sometimes want to close the session when e.g. a client conversion is finished. To instruct Camel to close the session you should set add a header with the key CamelMinaCloseSessionWhenComplete
to a boolean true value.
For instance the example below will close the session after it have written the bye message back to the client:
Code Block | ||||
---|---|---|---|---|
| ||||
from("mina:tcp://localhost:8080?sync=true&textline=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
exchange.getOut().setBody("Bye " + body);
exchange.getOut().setHeader(MinaConsumer.HEADER_CLOSE_SESSION_WHEN_COMPLETE, true);
}
});
|
Include Page | ||||
---|---|---|---|---|
|