@ComponentProfile(summary="A Solace native JCSMP message translator.", tag="solace,jcsmp,translator", since="3.9.3") public class SolaceJcsmpBytesMessageTranslator extends java.lang.Object implements SolaceJcsmpMessageTranslator
Once a message has been consumed from Solace, this translator will generate an AdaptrisMessage
from the
payload and headers of the consumed message.
Reverse translation when producing a message to a Solace end-point will create a Solace BytesXmlMessage again from the
payload and metadata of the AdaptrisMessage
The payload mapping is straight forward, but the metadata and header mapping does require a little configuration. Most of the header values on a Solace BytesXmlMessage are strings and in fact we assume every mapping will be a String, unless you configure the data-type for any mapping to be anything else.
An example of the XML configuration for a producer (therefore translating the AdaptrisMessage to a Solace message) with a simple mapping might be;
The above example will use the AdaptrisMessage metadata value from the key named "message-id" call the setter method "setMessageId()" on the Solace message.
In the adapter configuration file this class is aliased as solace-jcsmp-bytes-message-translator which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
SolaceJcsmpBytesMessageTranslator() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDeliveryMode() |
java.util.List<SolaceJcsmpMetadataMapping> |
getMappings() |
AdaptrisMessageFactory |
getMessageFactory() |
void |
setDeliveryMode(java.lang.String deliveryMode)
The mode of delivery; "PERSISTENT / NONPERSISTENT"
|
void |
setMappings(java.util.List<SolaceJcsmpMetadataMapping> mappings)
A list of mappings between Adaptris message metadata and Solace headers.
|
void |
setMessageFactory(AdaptrisMessageFactory messageFactory)
Defaults to the standard
DefaultMessageFactory . |
com.solacesystems.jcsmp.BytesXMLMessage |
translate(AdaptrisMessage message) |
AdaptrisMessage |
translate(com.solacesystems.jcsmp.BytesXMLMessage message) |
public AdaptrisMessage translate(com.solacesystems.jcsmp.BytesXMLMessage message) throws java.lang.Exception
translate
in interface SolaceJcsmpMessageTranslator
java.lang.Exception
public com.solacesystems.jcsmp.BytesXMLMessage translate(AdaptrisMessage message) throws java.lang.Exception
translate
in interface SolaceJcsmpMessageTranslator
java.lang.Exception
public AdaptrisMessageFactory getMessageFactory()
public void setMessageFactory(AdaptrisMessageFactory messageFactory)
DefaultMessageFactory
.messageFactory
- public java.lang.String getDeliveryMode()
public void setDeliveryMode(java.lang.String deliveryMode)
deliveryMode
- public java.util.List<SolaceJcsmpMetadataMapping> getMappings()
public void setMappings(java.util.List<SolaceJcsmpMetadataMapping> mappings)
mappings
-