|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Native binding to MQ via Spring? |
« View previous topic :: View next topic » |
Author |
Message
|
isaw |
Posted: Tue Aug 28, 2007 3:04 am Post subject: Native binding to MQ via Spring? |
|
|
Apprentice
Joined: 09 May 2007 Posts: 45
|
Hey guys,
I've already posted a question about this in the Spring forums but perhaps it's more relavent here as chances are, someone here might have already come across this.
I am trying to figure out how to natively bind to the MQ server using Spring on an AIX box.
Currently I have Spring configured to use the JMSTemplate102 and it connects to my MQ server via the usual DNS tcp/ip lookup. That config looks like this:
Code: |
<!-- WMQ Connection factory setup -->
<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="transportType">
<value>${mq.conn.transport_type}</value>
</property>
<property name="queueManager">
<value>${mq.conn.queuemanager}</value>
</property>
<property name="hostName">
<value>${mq.conn.hostname}</value>
</property>
<property name="port">
<value>${mq.conn.port}</value>
</property>
<property name="channel">
<value>${mq.conn.channel}</value>
</property>
</bean>
<!-- MQ destination queue setup -->
<bean id="destination" class="com.ibm.mq.jms.MQQueue">
<property name="baseQueueManagerName">
<value>${mq.dest.base_queuemanager}</value>
</property>
<property name="baseQueueName">
<value>${mq.dest.base_queuename}</value>
</property>
</bean>
<!-- the JMSTemplate102 setup -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory">
<ref bean="jmsConnectionFactory" />
</property>
<property name="pubSubDomain">
<value>false</value>
</property>
<property name="defaultDestination">
<ref bean="destination" />
</property>
</bean>
|
This works fine but the issue is that the project leads do not want this type of client connection -- they want me to bind to the server and skip looking up via DNS. Obviously this wouldn't be so hot if it weren't for the fact that both the code and the server are on the same box (please don't ask me why, I'm only the code monkey to implement their insanity!)
I still wish to use Spring to handle all this as it means no boilerplate code, no extensive exception handling, connection management, etc. But I cannot figure out how to bind to the server directly on the box without using typical, non-Spring based programming like:
Code: |
public static MQQueueManager connect(String queueManagerName) {
MQQueueManager queueManager = null;
try {
queueManager = new MQQueueManager(queueManagerName);
} catch (MQException mqE) {
logger.error("could not create connection", mqE);
}
return queueManager;
}
|
If anyone can give me some examples via Sprin configs or point me to a link/thread that deals with this I'd greatly appreciate it! |
|
Back to top |
|
 |
manicminer |
Posted: Tue Aug 28, 2007 3:12 am Post subject: |
|
|
 Disciple
Joined: 11 Jul 2007 Posts: 177
|
I'm not a spring expert but I think the following should work:
Code: |
<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="queueManager">
<value>${mq.conn.queuemanager}</value>
</property>
</bean>
|
Which should create a connection factory to the local queue manager |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|