2012-05-08 3 views
3

xml構成を使用せずにこれを実行します。私はSpring JMSを使って自分のニーズを満たしているかどうか調べています。JMSTemplate.receive()がDurableSubscriberを使用する必要があることを示す方法

MessageConsumer consumer = session.createDurableSubscriber(topic, "durable name"); 
Message message = consumer.receive(); 

XMLによる設定を必要とせずに:それは純粋なJMSコールと同等になるように

JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory); 
jmsTemplate.receive() 

を使用して受け取るには、とにかく同期を行うのはありますか?

答えて

0

これを試してください。どのようにこれを呼び出す予定ですか?

//Create connection facotry ..in this case JndiObjectFactoryBean because i am looking up a JNDI 
    org.springframework.jndi.JndiObjectFactoryBean connectionFactory = new JndiObjectFactoryBean(); 
    connectionFactory.setJndiName(jndiName); 
    connectionFactory.setJndiTemplate(jndiTemplate); 

    org.springframework.jms.core.JmsTemplate template = new org.springframework.jms.core.JmsTemplate(); 
    template.setConnectionFactory(connectionFactory) 
    template.setPubSubDomain(false); 

    Message message = template.receive(); 

詳細情報についてご確認 http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/jms/core/JmsTemplate.html#receive%28%29

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jms.html#jms-receiving-sync

関連する問題