ibm-messaging / event-streams-samples

Apache License 2.0
95 stars 168 forks source link

Is running a standalone Thread from Liberty Servlet the right approach? #3

Closed dselman closed 7 years ago

dselman commented 8 years ago

Hi there -- I've been looking at the Liberty sample that shows hows how to dequeue messages from MessageHub. It looks very similar to the JSE sample, but wrapped up into a Servlet. I was surprised to see the Servlet create a new Thread inside the initi() method, is there no better way of doing this? E.g. http://stackoverflow.com/questions/4691132/how-to-run-a-background-task-in-a-servlet-based-web-application

For example, if there was a JMS Resource Adapter for MessageHub then JEE applications could integrate via an MDB.

Any plans to offer a RAR/MDB style approach?

edoardocomar commented 7 years ago

Hi, you're right but the sample was not meant to show how to use J2EE infrastructure. It was simply meant to show how the SASL credentials retrieved from VCAP_SERVICES can be injected into server.xml.