类 MessageListenerAdapter

    • 方法详细资料

      • initDefaultStrategies

        @Deprecated
        protected void initDefaultStrategies()
        已过时。
        as of 4.1, in favor of calling the corresponding setters in the subclass constructor
        Initialize the default implementations for the adapter's strategies.
      • setDelegate

        public void setDelegate​(Object delegate)
        Set a target object to delegate message listening to. Specified listener methods have to be present on this target object.

        If no explicit delegate object has been specified, listener methods are expected to present on this adapter instance, that is, on a custom subclass of this adapter, defining listener methods.

      • getDelegate

        protected Object getDelegate()
        Return the target object to delegate message listening to.
      • getListenerMethodName

        protected String getListenerMethodName​(Message originalMessage,
                                               Object extractedMessage)
                                        throws JMSException
        Determine the name of the listener method that is supposed to handle the given message.

        The default implementation simply returns the configured default listener method, if any.

        参数:
        originalMessage - the JMS request message
        extractedMessage - the converted JMS request message, to be passed into the listener method as argument
        返回:
        the name of the listener method (never null)
        抛出:
        JMSException - if thrown by JMS API methods
        另请参阅:
        setDefaultListenerMethod(java.lang.String)
      • buildListenerArguments

        protected Object[] buildListenerArguments​(Object extractedMessage)
        Build an array of arguments to be passed into the target listener method. Allows for multiple method arguments to be built from a single message object.

        The default implementation builds an array with the given message object as sole element. This means that the extracted message will always be passed into a single method argument, even if it is an array, with the target method having a corresponding single argument of the array's type declared.

        This can be overridden to treat special message content such as arrays differently, for example passing in each element of the message array as distinct method argument.

        参数:
        extractedMessage - the content of the message
        返回:
        the array of arguments to be passed into the listener method (each element of the array corresponding to a distinct method argument)