Class MessageHandlerAdapter<T>

java.lang.Object
io.micronaut.jms.listener.MessageHandlerAdapter<T>
Type Parameters:
T - the type that the underlying MessageHandler can handle
All Implemented Interfaces:
jakarta.jms.MessageListener

public class MessageHandlerAdapter<T> extends Object implements jakarta.jms.MessageListener
Decorator for converting between MessageListener and MessageHandler. Will attempt to deserialize the given Message to an object of type <T> and then provide that to the delegate handler.
Since:
1.0.0
Author:
Elliott Pope
  • Constructor Details

    • MessageHandlerAdapter

      public MessageHandlerAdapter(MessageHandler<T> delegate, Class<T> clazz)
      Parameters:
      delegate - the underlying handler to delegate to.
      clazz - the parameter class of the delegate.
    • MessageHandlerAdapter

      public MessageHandlerAdapter(MessageHandler<T> delegate, Class<T> clazz, Deserializer deserializer)
      Parameters:
      delegate - the underlying handler to delegate to.
      clazz - the parameter class of the delegate.
      deserializer - the Deserializer to be used to convert the Message to a plain Java object
  • Method Details

    • onMessage

      public void onMessage(jakarta.jms.Message message)
      Specified by:
      onMessage in interface jakarta.jms.MessageListener