We have a Java EE application running on Glassfish 3.1 that needs to accept notifications from a legacy system written in Java. This legacy system provides a JAR file that should be used by any external applications wishing to subscribe to the system's notifications.
When used in a Java SE application, the library works like this:
- The library is initialized with connection parameters to the legacy system
- The library connects to the system and listens for notifications
- Our application registers for notifications by implementing an interface
- Whenever a notification comes, a method in the implementing class is called
We would like to reproduce the same in Java EE in a way that an EJB method is called whenever a notification is sent by the system.
Is JCA the way to go? How about a singleton EJB initializing the library and registering itself as a listener?
Good examples about this topic are hard to find, so if you have any guidance, I'd be grateful.