I have a service that I need to instantiate and keep alive and listen for incoming messages thoughout the life of my application.
What would be the best way to go about this. I was thinking create a SessionBean which contains all the code for listening and invoke it once via the Timer service or something. It could then pass off incoming messages to the approproate services etc... This would then exist for all of my application. I figure I could also use the ejbRemove method so that I can shutdown the listener properly upon shutdown.
Maybe instead / in addition to that I could have a sessionbean which has the listener/instance as static, same as above however I also need to send messages out the same instance, so I could implmentent business methods which would use that static instance of the service via multiple instances of the SB when sending messages...
Does this make sense?