Announcement Announcement Module
Collapse
No announcement yet.
Decorate the AbstractMessageListenerContainer#doInvokeListener( ) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Decorate the AbstractMessageListenerContainer#doInvokeListener( )

    Hi,
    I'm extending the DefaultMessageListenerContainer to have certain functionality in the receiveAndExecute() method. What I'm trying to achieve now is to be able to wrap some code around the line where the listener is invoked

    Code:
    In method:
    	protected void doInvokeListener(SessionAwareMessageListener listener, Session session, Message message)
    
    line:
            listener.onMessage(message, sessionToUse);
    My suggestion is that the above line of code be pulled out into a protected method so sub-classes could decorate it.
    Right now if I have to achieve this I have two choices.
    1. Rewrite (copy) the entire doInvokeListener method in my subclass and add what I want into it.
    2. Put my decoration inside the implementation of SessionAwareMessageListener. Which is restricting the clients of my application to use an instance of my specific decorated listener.
    Neither of these seem desirable.
    Do you think this is a valid requirement?

    Thanks,
    Abhi
Working...
X