Class 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;

       
         PERSISTENT
         
           
             MessageId
             message-id
           
           
             Priority
             message-priority
             Integer
           
         
       
     
    The above example will use the AdaptrisMessage metadata value from the key named "message-id" call the setter method "setMessageId()" on the Solace message.
    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.

    • Constructor Detail

      • SolaceJcsmpBaseTranslatorImp

        public SolaceJcsmpBaseTranslatorImp()
    • Method Detail

      • 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
      • 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 -