public class AdvancedMqSeriesImplementation extends VendorImplementationImp implements LicensedComponent
Advanced IBM MQ Series implementation.
Depending on your WebsphereMQ configuration you will need at least
com.ibm.mq.allclient.jar or these com.ibm.mq.jar, com.ibm.mqjms.jar, connector.jar, dhbcore.jar and jta.jar
from your WebsphereMQ installation.
If you intend on using bindings mode, then you may need to include additional jars such as com.ibm.mqbind.jar
This vendor implementation class directly exposes all the primitive and String getter and setters that are available in the MQConnectionFactory for maximum flexibility in configuration.
The key from the connection-factory-properties
element should match the name of the underlying MQConnectionFactory
property/method.
would call
<connection-factory-properties>
<key-value-pair>
<key>SendExitInit</key>
<value>SomeData</value>
</key-value-pair>
</connection-factory-properties>
MQConnectionFactory.setSendExitInit(String)
.
This vendor implementation also overrides VendorImplementationImp.applyVendorSessionProperties(javax.jms.Session)
so that
specific MQ session properties can be applied. The way of doing this is to supply a list of mq-session-properties, which includes the
property name, value and data-type of the value. You will need to consult your WebsphereMQ documentation or support team for a list of
available properties.
<session-properties>
<mq-session-property>
<property-name>OptimisticPublication</property-name>
<value>true</value>
<data-type>Boolean</data-type>
</mq-session-property>
</session-properties>
If you require SSL support then you should review this developerWorks article which contains a good primer about the settings that will be required for using SSL with the adapter.
By default, all JMS clients to MQ Series will create what is known as an MQRFH2 Header that will form part of the Websphere MQ
message. This is used to store (amongst other things) some of the JMS headers that you wanted to preserve using
MessageTypeTranslatorImp.setMoveJmsHeaders(Boolean)
, and all the custom JMS properties that you may
have chosen to preserve from AdaptrisMessage metadata by configuring
com.adaptris.core.jms.MessageTypeTranslatorImp#setMoveMetadata(Boolean)
to be true.This means that the message
format internally within WebpshereMQ is MQRFH2 and not MQSTR format. Accordingly the receiving application needs to be
able to parse MQRFH2 headers which may not be possible.
If the MQRFH2 Header/format is not required or you need to change the message type to MQSTR, then you need to tell MQSeries to
omit the MQRFH2 Header; this will mean that you'll lose all the JMS properties that are mapped into MQRFH2 as
standard by MQSeries and also any custom JMS Properties that you might be sending. To omit the MQRFH2 header, then you need
to add ?targetClient=1
after the queue name in your ProduceDestination
implementation. For
example, if the queue that you need to produce to is called SampleQ1 then the string you need to use is
queue:///SampleQ1?targetClient=1. More information about the mapping of JMS messages onto MQ Messages can be
found at this link
More generally speaking, the more powerful form of specifying a destination using uniform resource identifiers (URIs) is preferred. This form allows you to specify remote queues (queues on a queue manager other than the one to which you are connected). It also allows you to set the other properties contained in a com.ibm.mq.jms.MQQueue object. The URI for a queue begins with the sequence queue://, followed by the name of the queue manager on which the queue resides. This is followed by a further /, the name of the queue, and optionally, a list of name-value pairs that set the remaining Queue properties. For example: queue://Some_Other_Queue_Manager/SampleQ1?key1=value1&key2=value2. If you don't specify a queue manager in the URI then it is interpreted to be the queue manager to which you are currently connected to e.g. queue:///SampleQ1?key1=value1&key2=value2).
Various name value pairs can be used as part of the URI; these include, but is not limited to (some of these values may have a direct correlation to standard JMS headers, if you specify both, then behaviour is dependent on how WebsphereMQ JMS is configured)
Property | Description | Values |
---|---|---|
CCSID | Character set of the destination | integers - valid values listed in base WebSphere MQ documentation |
encoding | How to represent numeric fields | An integer value as described in the base WebSphere MQ documentation |
expiry | Lifetime of the message in milliseconds | 0 for unlimited, positive integers for timeout (ms) - This might interfere with any TTL value you configure in the producer. |
multicast | Sets multicast mode for direct connections | -1=ASCF, 0=DISABLED, 3=NOTR, 5=RELIABLE, 7=ENABLED |
persistence | Whether the message should be hardened to disk | 1=non-persistent, 2=persistent, -1=QDEF (use the queue definition) |
priority | Priority of the message | 0 through 9, -1=QDEF (use the queue definition)- This might interfere with any priority value you configure in the producer. |
targetClient | Whether the receiving application is JMS compliant | 0=JMS, 1=MQ |
This was built against WebsphereMQ 6.x, but tested against both Websphere 6.x and 7.x
MQConnectionFactory
In the adapter configuration file this class is aliased as advanced-mq-series-implementation which is the preferred alternative to the fully qualified classname when building your configuration.
License Required: BASIC
Modifier and Type | Class and Description |
---|---|
static class |
AdvancedMqSeriesImplementation.ConnectionFactoryProperty
Properties matched against various MQConnectionFactory methods.
|
static class |
AdvancedMqSeriesImplementation.SessionPropertyDataType
Properties matched against various MQSession methods.
|
log
Constructor and Description |
---|
AdvancedMqSeriesImplementation()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyProperties(com.ibm.mq.jms.MQConnectionFactory cf) |
void |
applyVendorSessionProperties(javax.jms.Session s) |
boolean |
connectionEquals(VendorImplementationBase comparable) |
javax.jms.ConnectionFactory |
createConnectionFactory() |
KeyValuePairSet |
getConnectionFactoryProperties() |
java.util.List<MqSessionProperty> |
getSessionProperties() |
boolean |
isEnabled(License license) |
void |
prepare() |
void |
setConnectionFactoryProperties(KeyValuePairSet crp) |
void |
setSessionProperties(java.util.List<MqSessionProperty> s)
Set any additional session properties to be applied.
|
createConsumer, createDestination, createQueue, createQueueReceiver, createSession, createTopic, createTopicSubscriber, retrieveBrokerDetailsForLogging
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createConnection
createQueueReceiver, createTopicSubscriber
public AdvancedMqSeriesImplementation()
Creates a new instance.
public javax.jms.ConnectionFactory createConnectionFactory() throws javax.jms.JMSException
createConnectionFactory
in interface VendorImplementation
javax.jms.JMSException
protected void applyProperties(com.ibm.mq.jms.MQConnectionFactory cf) throws javax.jms.JMSException
javax.jms.JMSException
public void applyVendorSessionProperties(javax.jms.Session s) throws javax.jms.JMSException
applyVendorSessionProperties
in class VendorImplementationImp
javax.jms.JMSException
VendorImplementationImp.applyVendorSessionProperties(javax.jms.Session)
public KeyValuePairSet getConnectionFactoryProperties()
public void setConnectionFactoryProperties(KeyValuePairSet crp)
crp
- the additional connectionFactoryProperties to setAdvancedMqSeriesImplementation.ConnectionFactoryProperty
public java.util.List<MqSessionProperty> getSessionProperties()
public void setSessionProperties(java.util.List<MqSessionProperty> s)
s
- the sessionProperties to setSessionProperty
public void prepare() throws CoreException
prepare
in interface ComponentLifecycleExtension
prepare
in class VendorImplementationImp
CoreException
public boolean isEnabled(License license)
isEnabled
in interface LicensedComponent
public boolean connectionEquals(VendorImplementationBase comparable)
connectionEquals
in interface ConnectionComparator<VendorImplementationBase>