Class SolaceJcsmpBaseTranslatorImp
- java.lang.Object
-
- com.adaptris.core.jcsmp.solace.translator.SolaceJcsmpBaseTranslatorImp
-
- All Implemented Interfaces:
SolaceJcsmpMessageTranslator
- Direct Known Subclasses:
SolaceJcsmpBytesMessageTranslator
,SolaceJcsmpBytesXmlMessageTranslator
,SolaceJcsmpTextMessageTranslator
,SolaceJcsmpXmlContentMessageTranslator
public abstract class SolaceJcsmpBaseTranslatorImp 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 XMLMessage 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 XMLMessage 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 second mapping will use the AdaptrisMessage metadata value, turn it into an integer value and call the setter "setPriority()" 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SolaceJcsmpBaseTranslatorImp.HeaderDataType
-
Constructor Summary
Constructors Constructor Description SolaceJcsmpBaseTranslatorImp()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDeliveryMode()
The mode of delivery; "PERSISTENT / NONPERSISTENT"java.util.List<SolaceJcsmpMetadataMapping>
getMappings()
A list of mappings between Adaptris message metadata and Solace headers.AdaptrisMessageFactory
getMessageFactory()
Defaults to the standardDefaultMessageFactory
.protected void
performHeaderMappings(AdaptrisMessage message, com.solacesystems.jcsmp.XMLMessage xmlMessage)
protected void
performMetadataMappings(com.solacesystems.jcsmp.XMLMessage message, AdaptrisMessage adaptrisMessage)
protected abstract com.solacesystems.jcsmp.XMLMessage
performPayloadTranslation(AdaptrisMessage source)
protected abstract void
performPayloadTranslation(com.solacesystems.jcsmp.XMLMessage source, AdaptrisMessage destination)
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 standardDefaultMessageFactory
.com.solacesystems.jcsmp.XMLMessage
translate(AdaptrisMessage message)
AdaptrisMessage
translate(com.solacesystems.jcsmp.XMLMessage message)
-
-
-
Method Detail
-
translate
public AdaptrisMessage translate(com.solacesystems.jcsmp.XMLMessage message) throws java.lang.Exception
- Specified by:
translate
in interfaceSolaceJcsmpMessageTranslator
- Throws:
java.lang.Exception
-
translate
public com.solacesystems.jcsmp.XMLMessage translate(AdaptrisMessage message) throws java.lang.Exception
- Specified by:
translate
in interfaceSolaceJcsmpMessageTranslator
- Throws:
java.lang.Exception
-
performPayloadTranslation
protected abstract com.solacesystems.jcsmp.XMLMessage performPayloadTranslation(AdaptrisMessage source)
-
performPayloadTranslation
protected abstract void performPayloadTranslation(com.solacesystems.jcsmp.XMLMessage source, AdaptrisMessage destination)
-
performMetadataMappings
protected void performMetadataMappings(com.solacesystems.jcsmp.XMLMessage message, AdaptrisMessage adaptrisMessage) throws java.lang.Exception
- Throws:
java.lang.Exception
-
performHeaderMappings
protected void performHeaderMappings(AdaptrisMessage message, com.solacesystems.jcsmp.XMLMessage xmlMessage) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getMessageFactory
public AdaptrisMessageFactory getMessageFactory()
Defaults to the standardDefaultMessageFactory
.
-
setMessageFactory
public void setMessageFactory(AdaptrisMessageFactory messageFactory)
Defaults to the standardDefaultMessageFactory
.- Parameters:
messageFactory
-
-
getDeliveryMode
public java.lang.String getDeliveryMode()
The mode of delivery; "PERSISTENT / NONPERSISTENT"
-
setDeliveryMode
public void setDeliveryMode(java.lang.String deliveryMode)
The mode of delivery; "PERSISTENT / NONPERSISTENT"- Parameters:
deliveryMode
-
-
getMappings
public java.util.List<SolaceJcsmpMetadataMapping> getMappings()
A list of mappings between Adaptris message metadata and Solace headers.
-
setMappings
public void setMappings(java.util.List<SolaceJcsmpMetadataMapping> mappings)
A list of mappings between Adaptris message metadata and Solace headers.- Parameters:
mappings
-
-
-