Interface MessageBeanListener

  • All Known Implementing Classes:
    MessageBeanListenerImpl

    public interface MessageBeanListener
    Lifecycle contract for a single MessageBeanListener. Implemented by the MessageBeanContainer and called by the MessageBeanClient for each message delivery. Each message delivery MUST call each of the three methods exactly once, in the same thread, and in the following order : 1. beforeMessageDelivery 2. deliverMessage 3. afterMessageDelivery
    Author:
    Kenneth Saks
    • Method Detail

      • beforeMessageDelivery

        void beforeMessageDelivery​(Method method,
                                   boolean txImported)
        Pre-delivery notification to the container. Any transaction initialization is peformed here. In addition, when this method returns, the current thread's context class loader will be set the message-bean's application class loader.
        Parameters:
        method - is the method that will be invoked during deliverMessage. It is used the container during transaction setup to lookup the appropriate transaction attribute.
        txImported - whether a transaction is being imported
      • deliverMessage

        Object deliverMessage​(Object[] params)
                       throws Throwable
        Deliver a message to a message bean instance.
        Parameters:
        params - to use of the method invocation. Can be null or an 0-length array if there are 0 arguments.
        Throws:
        Throwable - This is either an application exception as thrown from the message bean instance or a jakarta.ejb.EJBException in the case that the bean throws a system exception. Note that exceptions are *always* propagated, regardless of transaction type.
      • afterMessageDelivery

        void afterMessageDelivery()
        Post-delivery notification to the container. Container will perform any work required to commit/rollback a container-managed transaction. When this method returns, the thread's context class loader will be restored to the value it had when beforeMessageDelivery was called.
      • setResourceHandle

        void setResourceHandle​(ResourceHandle handle)