I'm developing an application to process HL7 messages, using Apache Camel
(1.6.1), MINA, HAPI and Spring. As a lot of it is new to me, I've been
following the example given by Roger Searjeant here:
http://sites.google.com/site/rogersearjeant/healthcare-and-hl7/hapi-ack-nak-message-helper.
(Thanks, Roger!). I've been developing using NetBeans 6.7 and have a test
class which sets everything up with FileSystemXmlApplicationContext, which
runs just fine and can be stopped and started at will without a problem.
However, my aim for production is that this application should live within
the context of a Spring MVC web application, started up when the webapp
starts up and shut down when the webapp shuts down. First time, it starts up
fine. But if I shut down Tomcat and restart, the webapp fails to start
properly because of a problem with the endpoint - evidently something is
still hanging on to the port from the previous run. The endpoint is defined
like this:
<camel:camelContext>
<camel:endpoint id="hl7listener"
uri="mina:tcp://localhost:8888?sync=true&codec=hl7codec"/>
</camel:camelContext>
My server app is a Spring-managed bean, with a defined init-method where the
route is added to the SpringCamelContext and the SpringCamelContext is
started, and a defined destroy-method where stop() is called on the
SpringCamelContext, but this latter never appears to run (nothing shows in
the log).
It may well be that there is a much better way of doing this, using
something like a ContextListener, in which case I'd be glad to hear of it.
In any case, what I need is a surefire way of killing off the listener when
the web server is restarted. Any suggestions would be most welcome.
--
View this message in context:
http://www.nabble.com/Proper-shutdown-of-endpoint-listener-with-Spring-MVC--tp24678499p24678499.html
Sent from the Camel - Users mailing list archive at Nabble.com.