Interface MessageConverter

All Known Subinterfaces:
SmartMessageConverter
All Known Implementing Classes:
JacksonJsonMessageConverter, MappingJackson2MessageConverter, MarshallingMessageConverter, MessagingMessageConverter, SimpleMessageConverter

public interface MessageConverter
Strategy interface that specifies a converter between Java objects and JMS messages.

Check out SimpleMessageConverter for a default implementation, converting between the 'standard' message payloads and JMS Message types.

Since:
1.1
Author:
Mark Pollack, Juergen Hoeller
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    fromMessage(jakarta.jms.Message message)
    Convert from a JMS Message to a Java object.
    jakarta.jms.Message
    toMessage(Object object, jakarta.jms.Session session)
    Convert a Java object to a JMS Message using the supplied session to create the message object.
  • Method Details

    • toMessage

      jakarta.jms.Message toMessage(Object object, jakarta.jms.Session session) throws jakarta.jms.JMSException, MessageConversionException
      Convert a Java object to a JMS Message using the supplied session to create the message object.
      Parameters:
      object - the object to convert
      session - the Session to use for creating a JMS Message
      Returns:
      the JMS Message
      Throws:
      jakarta.jms.JMSException - if thrown by JMS API methods
      MessageConversionException - in case of conversion failure
    • fromMessage

      Object fromMessage(jakarta.jms.Message message) throws jakarta.jms.JMSException, MessageConversionException
      Convert from a JMS Message to a Java object.
      Parameters:
      message - the message to convert
      Returns:
      the converted Java object
      Throws:
      jakarta.jms.JMSException - if thrown by JMS API methods
      MessageConversionException - in case of conversion failure