Class SolaceJcsmpProduceEventHandler

java.lang.Object
com.adaptris.core.jcsmp.solace.SolaceJcsmpProduceEventHandler
All Implemented Interfaces:
CacheEventListener, ComponentLifecycle, com.solacesystems.jcsmp.JCSMPStreamingPublishCorrelatingEventHandler, com.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler, EventListener

public class SolaceJcsmpProduceEventHandler extends Object implements com.solacesystems.jcsmp.JCSMPStreamingPublishCorrelatingEventHandler, ComponentLifecycle, CacheEventListener

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 Details

    • log

      protected transient org.slf4j.Logger log
  • Constructor Details

  • Method Details

    • handleErrorEx

      public void handleErrorEx(Object obj, com.solacesystems.jcsmp.JCSMPException ex, long arg2)
      Specified by:
      handleErrorEx in interface com.solacesystems.jcsmp.JCSMPStreamingPublishCorrelatingEventHandler
    • responseReceivedEx

      public void responseReceivedEx(Object obj)
      Specified by:
      responseReceivedEx in interface com.solacesystems.jcsmp.JCSMPStreamingPublishCorrelatingEventHandler
    • addUnAckedMessage

      public void addUnAckedMessage(AdaptrisMessage message) throws CoreException
      Throws:
      CoreException
    • init

      public void init() throws CoreException
      Specified by:
      init in interface ComponentLifecycle
      Throws:
      CoreException
    • handleError

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

      public void responseReceived(String arg0)
      Specified by:
      responseReceived in interface com.solacesystems.jcsmp.JCSMPStreamingPublishCorrelatingEventHandler
      Specified by:
      responseReceived in interface com.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler
    • itemEvicted

      public void itemEvicted(String key, Object value)
      Specified by:
      itemEvicted in interface CacheEventListener
    • itemExpired

      public void itemExpired(String key, Object value)
      Specified by:
      itemExpired in interface CacheEventListener
    • itemPut

      public void itemPut(String key, Object value)
      Specified by:
      itemPut in interface CacheEventListener
    • itemRemoved

      public void itemRemoved(String key, Object value)
      Specified by:
      itemRemoved in interface CacheEventListener
    • itemUpdated

      public void itemUpdated(String key, Object value)
      Specified by:
      itemUpdated in interface CacheEventListener