Class SolaceJcsmpProduceEventHandler

  • All Implemented Interfaces:
    ComponentLifecycle, com.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler

    public class SolaceJcsmpProduceEventHandler
    extends java.lang.Object
    implements com.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler, ComponentLifecycle

    A Solace JCSMP asynchronous producer event handler that is registered to the Solace producer.

    After a message has been produced to the Solace VPN this event handler will be called at some point in the future with either a success (the message was received without error) or failure (an error occurred on the Solace VPN).

    Once either a success or failure event for any given produced message is received this event handler will execute the registered AdaptrisMessage's success or failure code. The code executed on success or fail is determined by the consumer that originally created the message. For example; if your consumer is JMS, then on success of the producer producing the message the success code will likely be an acknowledgement/commit of the originally consumed message.

    NOTE: The success and failure code executed will not run in the workflow thread, but a callback thread maintained by the Solace client API. Therefore if you're bridging a JMS consumer to this Solace producer, then you must make sure your JMS consumer is run in asynchronous mode too. Standard rules of JMS will not allow you to act on (acknowledge/commit) a consumed message in a thread that is not the delivery thread. Simply make sure your not using a JMS message listener such as JmsConsumer, but instead an asynchronous consumer like JmsPollingConsumer.

    • Field Detail

      • log

        protected transient org.slf4j.Logger log
      • SOLACE_LATCH_KEY

        public static final java.lang.String SOLACE_LATCH_KEY
        See Also:
        Constant Field Values
    • Method Detail

      • handleError

        public void handleError​(java.lang.String messageId,
                                com.solacesystems.jcsmp.JCSMPException ex,
                                long arg2)
        Specified by:
        handleError in interface com.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler
      • responseReceived

        public void responseReceived​(java.lang.String messageId)
        Specified by:
        responseReceived in interface com.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler
      • addUnAckedMessage

        public void addUnAckedMessage​(java.lang.String messageId,
                                      AdaptrisMessage message)