This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Thanks for the explanation. I think I have a decent understanding of what you are doing. Let me see if I can explain what is happening as well as a potential solution.

The JMS source adapter is receiving the JMS Message, converting it into a Spring Integration Message, and then sending that to a MessageChannel. The handler that you have registered within an endpoint is subscribed to that channel. However, due to the inherently asynchronous model, the thread that handles the JMS Message sees "success" as long as the Message was sent to the channel. The underlying message listener container then acknowledges the JMS Message (if you have client ack mode). Meanwhile your handler is actually receiving the converted Spring Integration Message from the channel in another thread. Hopefully that makes sense (but please let me know if it does not).

What you should do is use a SynchronousChannel (newly added in M3) instead of the default asynchronous SimpleChannel. We will soon be adding namespace support, but for now this will require an explicit bean definition. The difference with a SynchronousChannel is that your handler will be executed on the same thread that sends to the channel. If your handler throws an Exception, the underlying Spring MessageListener container will not acknowledge the Message.