public class ForwardingNativeConsumerErrorHandler extends AbstractNativeErrorHandler
NativeErrorHandler
implementation for errors on consuming.
It is possible to encounter errors where the message read from the Websphere MQ queue cannot be translated to an AdaptrisMessage. Possible causes for this include; incorrect mapping configuration or an incorrect message type configuration.
In these cases the message will effectively be lost. We have consumed the message from WMQ, which means the message will be removed from the queue, but seeing as we cannot translate the message an exception will be thrown, but the message will be gone. This error handler fixes this very niche problem. Any errors encountered, once the message has been consumed from WMQ will be forwarded to this error handler.
The specific implementation of this error handler is to forward the MQMessage to any queue you specify in configuration. NOTE: The connection details to the broker will be taken from the parent consumer. You may only specify queue name to forward error messages to.
MessageOptions
are required to connect to a queue and send messages. This options will be taken from the parent
consumer, although you may override them in the configuration for this error handler. Note that options that specify the message
type will be ignored as the message is already available.
In the adapter configuration file this class is aliased as wmq-forwarding-native-consumer-error-handler which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
ForwardingNativeConsumerErrorHandler() |
Modifier and Type | Method and Description |
---|---|
ProduceDestination |
getDestination() |
MessageOptions |
getOptions() |
void |
onError(com.ibm.mq.MQMessage message)
Accepts an
com.ibm.mq.MQMessage message. |
void |
setDestination(ProduceDestination destination) |
void |
setOptions(MessageOptions options) |
registerParentConsumer, retrieveParentConsumer
public ForwardingNativeConsumerErrorHandler()
public void onError(com.ibm.mq.MQMessage message) throws java.lang.Exception
com.ibm.mq.MQMessage
message.
This message has been consumed from the WMQ queue and cannot be translated.
onError
will be triggered when translation errors occur.onError
in interface NativeErrorHandler
onError
in class AbstractNativeErrorHandler
java.lang.Exception
public ProduceDestination getDestination()
public void setDestination(ProduceDestination destination)
public MessageOptions getOptions()
public void setOptions(MessageOptions options)