|
Spring AMQP | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.amqp.support.converter.MarshallingMessageConverter
public class MarshallingMessageConverter
Spring Rabbit MessageConverter
that uses a Marshaller
and Unmarshaller
.
Marshals an object to a Message
and unmarshals a Message
to an object.
RabbitTemplate.convertAndSend(java.lang.Object)
,
RabbitTemplate.receiveAndConvert()
Constructor Summary | |
---|---|
MarshallingMessageConverter()
Construct a new MarshallingMessageConverter with no Marshaller or Unmarshaller set. |
|
MarshallingMessageConverter(Marshaller marshaller)
Construct a new MarshallingMessageConverter with the given Marshaller set. |
|
MarshallingMessageConverter(Marshaller marshaller,
Unmarshaller unmarshaller)
Construct a new MarshallingMessageConverter with the
given Marshaller and Unmarshaller. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
Object |
fromMessage(Message message)
Unmarshals the given Message into an object. |
void |
setMarshaller(Marshaller marshaller)
Set the Marshaller to be used by this message converter. |
void |
setUnmarshaller(Unmarshaller unmarshaller)
Set the Unmarshaller to be used by this message converter. |
Message |
toMessage(Object object,
MessageProperties messageProperties)
Marshals the given object to a Message . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarshallingMessageConverter()
MarshallingMessageConverter
with no Marshaller
or Unmarshaller
set.
The marshaller must be set after construction by invoking setMarshaller(Marshaller)
and
setUnmarshaller(Unmarshaller)
.
public MarshallingMessageConverter(Marshaller marshaller)
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.
marshaller
- object used as marshaller and unmarshaller
IllegalArgumentException
- when marshaller
does not implement the
Unmarshaller
interface as wellpublic MarshallingMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller)
MarshallingMessageConverter
with the
given Marshaller and Unmarshaller.
marshaller
- the Marshaller to useunmarshaller
- the Unmarshaller to useMethod Detail |
---|
public void setMarshaller(Marshaller marshaller)
Marshaller
to be used by this message converter.
public void setUnmarshaller(Unmarshaller unmarshaller)
Unmarshaller
to be used by this message converter.
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public Message toMessage(Object object, MessageProperties messageProperties) throws MessageConversionException
Message
.
toMessage
in interface MessageConverter
object
- the object to convert
MessageConversionException
- in case of conversion failurepublic Object fromMessage(Message message) throws MessageConversionException
Message
into an object.
fromMessage
in interface MessageConverter
message
- the message to convert
MessageConversionException
- in case of conversion failure
|
Spring AMQP | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |