Announcement Announcement Module
Collapse
No announcement yet.
JmsTemplate with Tibco Queue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JmsTemplate with Tibco Queue

    I'm having problems getting messages to send, and can't quite figure out what I'm doing wrong. I think I'm close (I hope).

    If I set jndiName on the internalJmsQueueConnectionFactory to "QueueConnectionFactory", I get errors, but if it's "ConnectionFactory", it works, yet doesn't send messages. I know there's some stuff going on behind the scenes that I have no clue about.

    Config:
    Code:
        <!-- JNDI Environment Template -->
        <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
            <property name="environment">
                <props>
                    <prop key="java.naming.factory.initial">com.tibco.tibjms.naming.TibjmsInitialContextFactory</prop>
                    <prop key="java.naming.provider.url">tcp://host.domain.com:1550</prop>
                    <prop key="java.naming.security.principal">...</prop>
                    <prop key="java.naming.security.credentials">...</prop>
                </props>
            </property>
        </bean>
    
        <!-- JMS Topic Connection Factory -->
        <bean id="internalJmsQueueConnectionFactory"  class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiTemplate" ref="jndiTemplate"/>
            <property name="jndiName" value="QueueConnectionFactory" />
        </bean>
    
    	 <bean id="authJmsQueueConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
    	   <property name="targetConnectionFactory" ref="internalJmsQueueConnectionFactory" />
    	   <property name="username" value="..." />
    	   <property name="password" value="..." />	 
    	 </bean>
    
        <!-- JMS Destination Resolver -->
        <bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
            <property name="jndiTemplate" ref="jndiTemplate" />
            <property name="cache" value="true" />
        </bean>
        
         
        <bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
            <property name="connectionFactory" ref="authJmsQueueConnectionFactory" />
            <property name="destinationResolver" ref="jmsDestinationResolver" />
            <property name="defaultDestinationName" value="int.q.to.test" />
            <property name="receiveTimeout" value="20000" />
        </bean>

    Code:
    public class SpringJMS {
    
        public static void main(String[] args) throws InterruptedException, IOException {
        	
            ApplicationContext context = new FileSystemXmlApplicationContext("/conf/SpringJMS-context.xml");
            
            JmsTemplate t = (JmsTemplate)context.getBean("jmsQueueTemplate");
            
            t.send(new MessageCreator() {
    			
    			@Override
    			public Message createMessage(Session s) throws JMSException {
    				TextMessage tm = s.createTextMessage();
    				
    				tm.setText("Sample Message");
    				
    				return tm;
    			}
    		});
            
        }
      
    }

  • #2
    hi i need to send messages to Tibco queue too...
    Did u resolve your problem? I need some help please.

    Comment

    Working...
    X