|
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.AbstractMessageConverter
org.springframework.amqp.support.converter.SimpleMessageConverter
public class SimpleMessageConverter
Implementation of MessageConverter
that can work with Strings, Serializable instances,
or byte arrays. The AbstractMessageConverter.toMessage(Object, MessageProperties)
method simply checks the
type of the provided instance while the fromMessage(Message)
method relies upon the
content-type
of the provided Message.
Field Summary | |
---|---|
static String |
DEFAULT_CHARSET
|
Constructor Summary | |
---|---|
SimpleMessageConverter()
|
Method Summary | |
---|---|
protected Message |
createMessage(Object object,
MessageProperties messageProperties)
Creates an AMQP Message from the provided Object. |
protected ObjectInputStream |
createObjectInputStream(InputStream is,
String codebaseUrl)
Create an ObjectInputStream for the given InputStream and codebase. |
Object |
fromMessage(Message message)
Converts from a AMQP Message to an Object. |
void |
setBeanClassLoader(ClassLoader beanClassLoader)
|
void |
setCodebaseUrl(String codebaseUrl)
Set the codebase URL to download classes from if not found locally. |
void |
setDefaultCharset(String defaultCharset)
Specify the default charset to use when converting to or from text-based Message body content. |
Methods inherited from class org.springframework.amqp.support.converter.AbstractMessageConverter |
---|
isCreateMessageIds, setCreateMessageIds, toMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_CHARSET
Constructor Detail |
---|
public SimpleMessageConverter()
Method Detail |
---|
public void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public void setCodebaseUrl(String codebaseUrl)
Follows RMI's codebase conventions for dynamic class download.
CodebaseAwareObjectInputStream
,
RMIClassLoader
public void setDefaultCharset(String defaultCharset)
public Object fromMessage(Message message) throws MessageConversionException
fromMessage
in interface MessageConverter
fromMessage
in class AbstractMessageConverter
message
- the message to convert
MessageConversionException
- in case of conversion failureprotected Message createMessage(Object object, MessageProperties messageProperties) throws MessageConversionException
createMessage
in class AbstractMessageConverter
object
- the payloadmessageProperties
- the message properties (headers)
MessageConversionException
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException
is
- the InputStream to read fromcodebaseUrl
- the codebase URL to load classes from if not found locally (can be null
)
IOException
- if creation of the ObjectInputStream failedCodebaseAwareObjectInputStream
|
Spring AMQP | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |