ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Native binding to MQ via Spring?

Post new topic  Reply to topic
 Native binding to MQ via Spring? « View previous topic :: View next topic » 
Author Message
isaw
PostPosted: Tue Aug 28, 2007 3:04 am    Post subject: Native binding to MQ via Spring? Reply with quote

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
View user's profile Send private message
manicminer
PostPosted: Tue Aug 28, 2007 3:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Native binding to MQ via Spring?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.