Class MarshallingMessageConverter

java.lang.Object
org.springframework.amqp.support.converter.AbstractMessageConverter
org.springframework.amqp.support.converter.MarshallingMessageConverter
All Implemented Interfaces:
MessageConverter, InitializingBean

public class MarshallingMessageConverter extends AbstractMessageConverter implements InitializingBean
Spring Rabbit MessageConverter that uses a Marshaller and Unmarshaller. Marshals an object to a Message and unmarshals a Message to an object.
Author:
Mark Fisher, Arjen Poutsma, Juergen Hoeller, James Carr
See Also:
  • Constructor Details

    • MarshallingMessageConverter

      public MarshallingMessageConverter()
      Construct a new MarshallingMessageConverter with no Marshaller or Unmarshaller set. The marshaller must be set after construction by invoking setMarshaller(Marshaller) and setUnmarshaller(Unmarshaller) .
    • MarshallingMessageConverter

      public MarshallingMessageConverter(Marshaller marshaller)
      Construct a new MarshallingMessageConverter with the given Marshaller set.

      If the given Marshaller also implements the Unmarshaller interface, it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.

      Note that all Marshaller implementations in Spring also implement the Unmarshaller interface, so that you can safely use this constructor.

      Parameters:
      marshaller - object used as marshaller and unmarshaller
      Throws:
      IllegalArgumentException - when marshaller does not implement the Unmarshaller interface as well
    • MarshallingMessageConverter

      public MarshallingMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller)
      Construct a new MarshallingMessageConverter with the given Marshaller and Unmarshaller.
      Parameters:
      marshaller - the Marshaller to use
      unmarshaller - the Unmarshaller to use
  • Method Details