@ComponentProfile(summary="Receive messages from WebsphereMQ using the native client", tag="consumer,websphere", recommended={AttachedConnection.class,DetachedConnection.class}) public class NativeConsumer extends AdaptrisPollingConsumer implements LicensedComponent
Depending on your WebsphereMQ configuration you will need to have installed and configured the WebsphereMQ Client software for your platform. The jars from the WebsphereMQ Client software should be copied into the adapter's lib directory.
In the adapter configuration file this class is aliased as wmq-native-consumer which is the preferred alternative to the fully qualified classname when building your configuration.
License Required: ENTERPRISE
AdaptrisPollingConsumer.LockOperator
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
NativeConsumer() |
Modifier and Type | Method and Description |
---|---|
void |
addFieldMapper(FieldMapper p)
Add a property mapper to the list of configured property mappers.
|
NativeErrorHandler |
getErrorHandler() |
java.util.List<FieldMapper> |
getFieldMappers() |
boolean |
getLogAllExceptions() |
MessageOptions |
getOptions() |
java.util.List<FieldMapper> |
getPreGetFieldMappers() |
void |
init() |
boolean |
isEnabled(License license) |
protected void |
prepareConsumer() |
int |
processMessages() |
void |
registerProxy(com.adaptris.core.wmq.ConsumerDelegate delegate)
This is used for testing purposes
|
com.adaptris.core.wmq.ConsumerDelegate |
retrieveProxy()
This is used for testing purposes
|
void |
setErrorHandler(NativeErrorHandler errorHandler) |
void |
setFieldMappers(java.util.List<FieldMapper> l)
Set the list of property mappers mapping from MQMessage fields.
|
void |
setLogAllExceptions(boolean b)
Specify whether to log all exceptions encountered during processing.
|
void |
setOptions(MessageOptions options)
Set the specific options when opening a MQQueue and receiving messages.
|
void |
setPreGetFieldMappers(java.util.List<FieldMapper> preGetFieldMappers)
Specifies pre-get field mappers
|
close, continueProcessingMessages, continueProcessingMessages, getMaxMessagesPerPoll, getPoller, getReacquireLockBetweenMessages, prepare, releaseLock, setMaxMessagesPerPoll, setPoller, setReacquireLockBetweenMessages, start, stop
changeState, getDestination, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState, setDestination
createName, createQualifier, decode, encode, getEncoder, getIsConfirmation, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isConfirmation, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsConfirmation, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isConfirmation, isTrackingEndpoint
public void init() throws CoreException
init
in interface ComponentLifecycle
init
in class AdaptrisPollingConsumer
CoreException
public int processMessages()
processMessages
in class AdaptrisPollingConsumer
public com.adaptris.core.wmq.ConsumerDelegate retrieveProxy()
public void registerProxy(com.adaptris.core.wmq.ConsumerDelegate delegate)
public MessageOptions getOptions()
public void setOptions(MessageOptions options)
This consumer implementation makes use of the MQQueue#getCurrentDepth() method. As a result, if you choose non default queue
opening options you must explicitly enable the flag MQC.MQOO_INQUIRE as part of
MessageOptions.setQueueOpenOptions(String)
options
- the options to setpublic java.util.List<FieldMapper> getFieldMappers()
public void setFieldMappers(java.util.List<FieldMapper> l)
l
- the propertyMappers to setFieldMapper
public void addFieldMapper(FieldMapper p)
p
- the property mapperFieldMapper
public boolean getLogAllExceptions()
setLogAllExceptions(boolean)
public void setLogAllExceptions(boolean b)
The default value is false, which means that a simple one-line log message is output each time the PollingConsumer encounters an exception, in the expectation that the errors are transient and will be resolved by the next scheduled poll. In some cases, this is not desired, perhaps you are testing some complex configuration, and you need to see the staktrace associated with the exception generated by WebsphereMQ
b
- the logAllExceptions to setpublic boolean isEnabled(License license)
isEnabled
in interface LicensedComponent
protected void prepareConsumer() throws CoreException
prepareConsumer
in class AdaptrisPollingConsumer
CoreException
public void setPreGetFieldMappers(java.util.List<FieldMapper> preGetFieldMappers)
Sets a list of FieldMappers that will be applied to the empty MQMessage object sent to the MQ Queue Manager when retrieving messages. This enables items such as messageType and version to be set prior to fetching messages.
preGetFieldMappers
- public java.util.List<FieldMapper> getPreGetFieldMappers()
public NativeErrorHandler getErrorHandler()
public void setErrorHandler(NativeErrorHandler errorHandler)