Class SolaceJcsmpProduceEventHandler
- java.lang.Object
-
- com.adaptris.core.jcsmp.solace.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 likeJmsPollingConsumer
.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
log
static java.lang.String
SOLACE_LATCH_KEY
-
Constructor Summary
Constructors Constructor Description SolaceJcsmpProduceEventHandler(SolaceJcsmpAbstractProducer producer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUnAckedMessage(java.lang.String messageId, AdaptrisMessage message)
void
handleError(java.lang.String messageId, com.solacesystems.jcsmp.JCSMPException ex, long arg2)
void
init()
void
responseReceived(java.lang.String messageId)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, start, stop
-
-
-
-
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
-
-
Constructor Detail
-
SolaceJcsmpProduceEventHandler
public SolaceJcsmpProduceEventHandler(SolaceJcsmpAbstractProducer producer)
-
-
Method Detail
-
handleError
public void handleError(java.lang.String messageId, com.solacesystems.jcsmp.JCSMPException ex, long arg2)
- Specified by:
handleError
in interfacecom.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler
-
responseReceived
public void responseReceived(java.lang.String messageId)
- Specified by:
responseReceived
in interfacecom.solacesystems.jcsmp.JCSMPStreamingPublishEventHandler
-
addUnAckedMessage
public void addUnAckedMessage(java.lang.String messageId, AdaptrisMessage message)
-
init
public void init() throws CoreException
- Specified by:
init
in interfaceComponentLifecycle
- Throws:
CoreException
-
-