jmstemplate

Unit testing with JMS (ActiveMQ)

痞子三分冷 提交于 2019-12-04 00:30:59
How to do unit testing with JMS ? Is it some de-facto for this ? I googled something - Unit testing for JMS: http://activemq.apache.org/how-to-unit-test-jms-code.html - jmsTemplate: activemq.apache.org/jmstemplate-gotchas.html - mockRunner : mockrunner.sourceforge.net/ Do you have any good experience on those and suggestion for me ? In my experience (after trying to do the same thing) when you are using JMS you are doing something like 1) Get JMS Message 2) Extract Object from Message 3) Do something with Object From that point of view I would suggest you unit test #3 but don't bother unit

What are template classes in Spring Java? Why are they called templates? For example jdbc-template, jms-template etc

让人想犯罪 __ 提交于 2019-12-03 23:46:01
I'm new to Java. I've only been programming it for about a year. What does Spring mean by the use of templates? In Spring, there is jdbc-templates, jms-templates etc.. What are template classes in java? Are they a special kind of design pattern or what? Thank you in advance. They are called template as use the Template method pattern. http://en.wikipedia.org/wiki/Template_method_pattern Basically the idea is define the operation needed to do something in an abstract class or super class then implement a class that use the operation previous defined. In the case of spring allow that operation

Control message listener container to stop for certain period and start again to listen

南楼画角 提交于 2019-12-02 16:33:09
问题 Listener : <bean id="msglistenerForAuditEvent" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="jmsFactory"/> <property name="sessionTransacted" value="true"/> <property name="destinationName" value="test.event"/> <property name="messageListener" ref="auditListener" /> </bean> I want to stop the container to listen the JMS messages and start it again after certain period? Can it be acheived? 回答1: maybe there is better solution

Control message listener container to stop for certain period and start again to listen

北城余情 提交于 2019-12-02 09:53:49
Listener : <bean id="msglistenerForAuditEvent" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="jmsFactory"/> <property name="sessionTransacted" value="true"/> <property name="destinationName" value="test.event"/> <property name="messageListener" ref="auditListener" /> </bean> I want to stop the container to listen the JMS messages and start it again after certain period? Can it be acheived? maybe there is better solution but i think this one can fit : import org.springframework.beans.factory.annotation.Autowired; import org

Creating temporary JMS jms topic in Spring

a 夏天 提交于 2019-12-01 08:48:58
I'm trying to refactor some legacy code to use Spring to handle the jms connections to a mainframe service. I need to connect create a temporary topic for the mainframe service reply and set that as the message.setJMSReplyTo(replyTo); in the message before I send the message. Can anyone provide examples of this? I have not found anything in the documentation that allows you to get to the low level jms objects such as the session or TopicConnection in order to create a temporary topic. If you need low-level access to the JMS API using JmsTemplate , then you need to use one of JmsTemplate's

Creating temporary JMS jms topic in Spring

时间秒杀一切 提交于 2019-12-01 05:40:34
问题 I'm trying to refactor some legacy code to use Spring to handle the jms connections to a mainframe service. I need to connect create a temporary topic for the mainframe service reply and set that as the message.setJMSReplyTo(replyTo); in the message before I send the message. Can anyone provide examples of this? I have not found anything in the documentation that allows you to get to the low level jms objects such as the session or TopicConnection in order to create a temporary topic. 回答1: If

ACTIVEMQ- publisher subscriber hello world example

淺唱寂寞╮ 提交于 2019-11-28 18:21:18
There are two programs: subscriber and publisher... Subscriber is able to put the message onto the topic and the message is sent successfully. When I check the activemq server on my browser it shows 1 msg enqueued . But when I run the consumer code, it is not receiving the message Here is the producer code: import javax.jms.*; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; public class producer { private static String url = ActiveMQConnection.DEFAULT_BROKER_URL; public static void main(String[] args) throws JMSException { ConnectionFactory