On Sat, Jan 23, 2010 at 8:08 AM, huntc <hu...@mac.com> wrote:
>
> Hi guys,
>
> Turns out that I'm using MinaProducer and not MinaConsumer of course;
> MinaConsumer is the one that has the HEADER_CLOSE_SESSION_WHEN_COMPLETE
> logic and MinaProducer isn't so capable by the looks of it.
>
> I was hoping that stopping the template by calling its stop method would in
> turn cause the MinaProducer to close its session. It does not.
>
> I then reverted to the lower level method of creating a producer for my
> endpoint and then using the following logic:
>
>
>  CamelContext camelContext = exchange.getContext();
>
>  Endpoint endpoint = camelContext.getEndpoint(smsSenderEndpoint);
>  Producer producer = endpoint.createProducer();
>  producer.start();
>
>  try {
>    ...
>
>    // For each message to send
>    Exchange smsExchange = producer.createExchange();
>    smsExchange.getIn().setBody(requestMessage);
>    producer.process(smsExchange);
>    Object replyMessage = smsExchange.getOut().getBody();
>
>    …
>
>  } finally {
>        producer.stop();
>  }
>
>
> Is this the best approach for sending out a stream of messages through the
> same channel and then ensuring that the channel is closed down; or should we
> be looking at some new functionality perhaps in the form of some header or
> method indicating that a session should be closed by the producer?
>

Yeah create a ticket in JIRA to allow closing the session after usage,
just as we have added to FTP which is called disconnect.


> Kind regards,
> Christopher
> --
> View this message in context: 
> http://old.nabble.com/requestBodyAndHeader-and-HEADER_CLOSE_SESSION_WHEN_COMPLETE-tp27175565p27283994.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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

Reply via email to