I’m writing an inbound resource adapter (connector module) on Glassfish 3.1 and I’ve noticed in the Java EE SDK samples that an MDB is used to deliver messages from an EIS to Glassfish applications. Is it necessary to use an MDB if the target object is an EJB? Would it be wise to do a JNDI lookup for the target EJB and deliver to it directly, avoiding the MDB altogether?
Thanks!
In the latter case you perform a synchronous operation, whereas the first approach is an asynchronous one. In application to application (A2A) integration scenarios it’s almost always a good decision to implement an asynchronous interface. A lot has been written about this, let me just refer to the Java documentation itself, e.g. section 6.3.3:
To conclude, maybe it’s not necessary, but it may be wise to implement an MDB.