We are trying to connect from our mule service to queue. This queue is on Websphere application server and we are using Websphere default messages provider.
How can we set our connector configuration to match this queue ??
We are using default JMS connector..
You need to refer to the section of the IBM Knowledge Center explaining JNDI Connections to SiBus.
If you are using EE, then I recommend using WMQ connector. Documentation available in: http://www.mulesoft.org/documentation...
If you have to use JMS, you need to create a spring bean for WebSphere connection factory and use it in your JMS connector connectionFactory-ref attribute.
<spring:bean name="MQConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<spring:property name="hostName" value="localhost"/>
<spring:property name="port" value="1414"/>
<spring:property name="queueManager" value="localmanager"/>
<spring:property name="transportType" value="1"/>
</spring:bean>
Don't forget to copy com.ibm.mqjms.jar into your Mule's classpath.
You need to use the com.ibm.mq.jms.MQXAQueueConnectionFactory class instead if you are using XA transactions.
Related
I am using JMS Connector to connect to IBM MQ. If I use IBM MQ Connector I have option (targetClient="NO_JMS_COMPLIANT") to disable RFH Header from the message. How can I achieve the same thing using the JMS Connector. My JMS config looks like below
<jms:config name="JMS_Config" doc:name="JMS Config" doc:id="b675becf-06f3-4847-bb95-4f468d5353ea" >
<jms:generic-connection specification="JMS_2_0" connectionFactory="WMQ_ConnectionFactory" />
</jms:config>
Connection Factory looks like this:
<bean id="WMQ_ConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory" name="WMQ_ConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="MQ-SLQ01"/>
<property name="port" value="1414"/>
<property name="queueManager" value="SLQ01"/>
<property name="channel" value="*******"/>
</bean>
JMS Connector config looks like this:
<jms:publish-consume doc:name="Publish consume" doc:id="b1d40cc6-deb0-42f0-aa50-4b230d843794" config-ref="JMS_Config" destination="P2.REQUEST" sendCorrelationId="ALWAYS">
<jms:message >
<jms:reply-to destination="P2.REPLY" />
</jms:message>
</jms:publish-consume>
I have tried adding request queue name with P2.REQUEST?targetClient=1. I could not see any changes.
I doubt the JMS connector allows to select a non-JMS compatible mode that is specific to a broker (IBM MQ). It a generic connector which provides no broker specific features. You should be using the IBM MQ connector for that that already provides that specific feature.
And alternate action you could take would be to disable the RFH2 header by using a setting on the queue.
ALTER QLOCAL(P2.REQUEST) PROPCTL(NONE)
This will strip all properties (RFH2 header) off the message before delivering it to any application that doesn't supply a message handle.
We have build an Mule applications with 1 mule nodes and 2 WMQ Manager. We are using HA proxy to route the traffic to multiple queue manager.(in properties file, we specify queuemanager = * )
Though we create multiple connections from Mule, all the connections are going to the same queue manager.( lets say, I keep numberofConsumer = 16 ) all the 16 connections are going to the same queue manager.
Did anyone encountered this issue? any work around. Composite component solves this issue but composite element is not in mule 4.
I am using the IBM jar. com.ibm.mq.allclient-8.0.0.3.jar. I am using the below connection factory and MQ Connector Factory
<wmq:connector name="drs-Request" port="${drs.mq.port}" transportType="CLIENT_MQ_TCPIP" specification="1.1" targetClient="JMS_COMPLIANT" validateConnections="true" maxRedelivery="-1" numberOfConsumers="${drs.mq.no.of.consumers}" connectionFactory-ref="drsConnectionFactory" doc:name="WMQ">
<reconnect-forever blocking="false" frequency="${drs.mq.reconnection.frequency}"/>
</wmq:connector>
<spring:beans>
<spring:bean id="drsConnectionFactory" name="drsConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory">
<spring:property name="channel" value="${drs.mq.channel}"/>
<spring:property name="hostName" value="${drs.mq.hostname}"/>
<spring:property name="port" value="${drs.mq.port}"/>
<spring:property name="queueManager" value="${drs.mq.queuemanager}"/>
<spring:property name="transportType" value="1"/>
<spring:property name="sSLCipherSuite" value="${drs.mq.ciphersuite}"/>
</spring:bean>
Thanks
I want to use Apache Camel to get a message on IBM MQ in a spring boot project.
I use sprin boot annotation based.
I dont find any fully example: pom.xml, receiver, configuration class, ...
Is there anyone to help me? Any link, documentation, ...?
Thanks a lot of
Take a look at a new Spring Boot Starter for MQ that may help here. The README shows how to modify the JMS Getting Started sample here to use IBM MQ instead of ActiveMQ. And the MQ jars - including this starter - are all on Maven Central for easy access.
You could search for an example that uses Spring Boot, Camel and ActiveMQ to get a first impression. Since you use Camel most differences between IBM MQ and ActiveMQ should be hidden.
However, you have to use the standard JMS component instead of the dedicated ActiveMQ component of Camel.
In your Application class, you will need create a bean for a IBM component, I just did it for an application in spring xml, like this:
<bean id="cf" class="com.ibm.mq.jms.MQConnectionFactory">
<property name="transportType" value="1" />
<property name="hostName" value="localhost" />
<property name="port" value="1414" />
<property name="queueManager" value="QMGRSCORE" />
<property name="channel" value="EXTAPP.SRVCONN" />
</bean>
But once I did a bean connection for a MongDB in spring boot, may you can do something like this:
#Bean(name = "myDb")
public MongoClient myDb() {
return new MongoClient();
}
But putting the IBM values inside this bean.
We are upgrading our project from Spring 2.5.6 to 3.2.3 and Hibernate/JPA to 4.2.3.
In spring-ds.xml for transaction management we replaced original below config
<bean id="transactionManager"
class="org.springframework.transaction.jta.WebSphereUowTransactionManager">
<!-- This property is specifically required for JMS -->
<property name="transactionManager" ref="baseTransactionManager" />
</bean>
<bean id="baseTransactionManager"
class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean" />
<tx:annotation-driven transaction-manager="transactionManager" />
to below as WebSphereTransactionManagerFactoryBean class is superseded in latest WAS :
<bean id="transactionManager"
class="org.springframework.transaction.jta.WebSphereUowTransactionManager" />
and JMS msg listener config looks like below :
<bean id="xxtMsgListenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="jmsxxConnectionFactory" />
<property name="destination" ref="jmsxxQueue" />
<property name="messageListener" ref="xxMessageListener" />
<property name="transactionManager" ref="transactionManager" />
<property name="taskExecutor" ref="taskExecutor" />
</bean>
With above config we are getting below error in WAS logs :
Setup of JMS message listener invoker failed for destination
queue://xxQueue?busName=zzBus' - trying to recover. Cause: No JTA UserTransactionavailable - programmatic PlatformTransactionManager.getTransaction usage not supported
Is there any other config/property required to upgrade to spring 3.2.3 ? or to config WebSphereUowTransactionManager do we need to set any property ?
In case you are using Hibernate in your application, the actual Hibernate version used can be the root cause of the problem.
We spent half a day debugging it (on a WebSphere box), and then found that indeed it was the hibernate version upgrade (from 4.2.7.Final to 4.2.12.Final) which caused issue, not the JMS configuration.
UPDATE: It seems that Hibernate includes transaction-api jboss-transaction-api_1.1_spec which was not compatible with the one present on Websphere. Simply excluding this from hibernate resolved the issue.
on the DefaultMessageListenerContainer, try setting the sessionTransacted property to true. this should enable transaction support with WebSphere
The error happens because you have used JTA transaction manager, while your connection factory is not XA capable. Essentially injected implementation of ConnectionFactory does not implement JTA interfaces. Thus transaction manager isn't able of enrolling a message consumption into a new instance of UserTransaction.
In other to fix this issues the one needs to use XA capable ConnectionFactory, or other non-jta transaction manager like Spring's JmsTransactionManager.
In the past, I've been able to successfully connect Camel to a Message Queue exposed as a JNDI resource in WebSphere [1]. This works with a Connection Factory. Great.
Now today, I have a situation where sys admins have only provided an Activation Specification. No Connection Factory. Here's what we've got:
SIBus name: ________
Provider endpoint: ________
Topic space: Default.Topic.Space
Messaging Engine Name: ________
Topic name: ________
From what I've read, Activation Specification is intended for MDBs (Message Driven Beans). But Spring has some APIs for ActivationSpec -- DefaultJmsActivationSpecFactory, for example -- so I'm optimistic I can configure Camel / Spring to work with an Activation Specification. I'm not sure that it matters, but this is an SIBus with a foreign bus.
My question is:
Has anyone had any luck configuring Camel to communicate with an Activation Specification?
See also:
What's the difference between ActivationSpec and ConnectionFactory?
Spring JMS and WebSphere
Spring Support for JCA Message Endpoints
[1] For reference, here's our hard-won Camel config that connects Camel to a Message Queue via a JNDI resource (Connection Factory). Since we had to piece this config together with almost no documentation, I'm hoping a similar config can be done for Activation Spec.
<jee:jndi-lookup id="myTargetConnectionFactory" jndi-name="${mq.jndi-name}"/>
<bean id="jmsDestResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver"/>
<bean id="myConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="myTargetConnectionFactory"/>
<property name="username" value="${mq.username}"/>
<property name="password" value=""/>
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="myConnectionFactory" />
<property name="destinationResolver" ref="jmsDestResolver" />
<property name="concurrentConsumers" value="1" />
<property name="maxConcurrentConsumers" value="10" />
<property name="cacheLevelName" value="CACHE_NONE" />
</bean>