@ComponentProfile(summary="Send messages to WebsphereMQ using the native client", tag="producer,websphere", recommended={AttachedConnection.class,DetachedConnection.class}) public class NativeProducer extends ProduceOnlyProducerImp 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.
If you configure FieldMappers, then by default the current date and time is inserted as the putDateTime field (using
MQC.MQOO_SET_ALL_CONTEXT means that all fields are undefined). This value may be overridden by explicitly declaring a FieldMapper
for the putDateTime field. In all cases, DateFormatUtil.parse(String)
will be used to parse any
values to be used for putDateTime.
In the adapter configuration file this class is aliased as wmq-native-producer which is the preferred alternative to the fully qualified classname when building your configuration.
License Required: ENTERPRISE
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
NativeProducer() |
Modifier and Type | Method and Description |
---|---|
void |
addFieldMapper(FieldMapper p)
Add a property mapper to the list of configured property mappers.
|
protected boolean |
checkOptions() |
void |
close() |
java.lang.Boolean |
getCheckOptions() |
java.util.List<FieldMapper> |
getFieldMappers() |
MessageOptions |
getOptions() |
void |
init() |
boolean |
isEnabled(License license) |
void |
prepare() |
void |
produce(AdaptrisMessage msg,
ProduceDestination destination) |
void |
registerProxy(com.adaptris.core.wmq.ProducerDelegate delegate)
This is used for testing purposes
|
com.adaptris.core.wmq.ProducerDelegate |
retrieveProxy()
This is used for testing purposes
|
void |
setCheckOptions(java.lang.Boolean b)
Specify whether or not to check the queue options and message options.
|
void |
setFieldMappers(java.util.List l)
Set the list of properties to map into MQMessage fields.
|
void |
setOptions(MessageOptions options) |
void |
start() |
void |
stop() |
produce, request, request, request, request
getDestination, setDestination
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, 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, isTrackingEndpoint
public com.adaptris.core.wmq.ProducerDelegate retrieveProxy()
public void registerProxy(com.adaptris.core.wmq.ProducerDelegate delegate)
public final void prepare() throws CoreException
prepare
in interface ComponentLifecycleExtension
CoreException
public boolean isEnabled(License license)
isEnabled
in interface LicensedComponent
public void produce(AdaptrisMessage msg, ProduceDestination destination) throws ProduceException
produce
in interface AdaptrisMessageSender
ProduceException
AdaptrisMessageSender.produce(com.adaptris.core.AdaptrisMessage,
com.adaptris.core.ProduceDestination)
public void close()
close
in interface ComponentLifecycle
ComponentLifecycle.close()
public void init() throws CoreException
init
in interface ComponentLifecycle
CoreException
ComponentLifecycle.init()
public void start() throws CoreException
start
in interface ComponentLifecycle
CoreException
ComponentLifecycle.start()
public void stop()
stop
in interface ComponentLifecycle
ComponentLifecycle.stop()
public java.util.List<FieldMapper> getFieldMappers()
public void setFieldMappers(java.util.List l)
l
- the propertyMappers to setFieldMapper
,
addFieldMapper(FieldMapper)
public void addFieldMapper(FieldMapper p)
If any FieldMapper
s are configured, then the corresponding MQOO_SET_ALL_CONTEXT or MQOO_SET_IDENTITY_CONTEXT
should be set for MessageOptions.setQueueOpenOptions(String)
and MQPMO_SET_IDENTITY_CONTEXT or MQPMO_SET_ALL_CONTEXT
should be set for MessageOptions.setMessageOptions(String)
. If these flags are not set, then it is unlikely that any
field mapping that you do will be passed through to WebsphereMQ
p
- the property mapperMessageOptions.setMessageOptions(String)
,
MessageOptions.setQueueOpenOptions(String)
public MessageOptions getOptions()
public void setOptions(MessageOptions options)
options
- the options to setpublic java.lang.Boolean getCheckOptions()
public void setCheckOptions(java.lang.Boolean b)
If any FieldMapper
instances are configured, then the corresponding MQOO_SET_ALL_CONTEXT or MQOO_SET_IDENTITY_CONTEXT
generally needs to be set for MessageOptions.setQueueOpenOptions(String)
and MQPMO_SET_IDENTITY_CONTEXT or
MQPMO_SET_ALL_CONTEXT for MessageOptions.setMessageOptions(String)
. If these flags are not set, then we have found that
any field mapping that you do is not passed through to WebsphereMQ
If set to true, then if these options are not set, then they are added automatically.
b
- default is true, false to not check options.MessageOptions.setMessageOptions(String)
,
MessageOptions.setQueueOpenOptions(String)
protected boolean checkOptions()