use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method processAndReplyWithSendToQueue.
@Test
void processAndReplyWithSendToQueue() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
MessagingMessageListenerAdapter listener = createInstance(this.factory, getListenerMethod(methodName, String.class), container);
processAndReplyWithSendTo(listener, "replyDestination", false);
assertListenerMethodInvocation(this.sample, methodName);
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method processAndReplyWithSendToTopic.
@Test
void processAndReplyWithSendToTopic() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setPubSubDomain(true);
MessagingMessageListenerAdapter listener = createInstance(this.factory, getListenerMethod(methodName, String.class), container);
processAndReplyWithSendTo(listener, "replyDestination", true);
assertListenerMethodInvocation(this.sample, methodName);
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method processAndReplyWithCustomReplyQosSettings.
@Test
void processAndReplyWithCustomReplyQosSettings() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
QosSettings replyQosSettings = new QosSettings(1, 6, 6000);
container.setReplyQosSettings(replyQosSettings);
MessagingMessageListenerAdapter listener = createInstance(this.factory, getListenerMethod(methodName, String.class), container);
processAndReplyWithSendTo(listener, "replyDestination", false, replyQosSettings);
assertListenerMethodInvocation(this.sample, methodName);
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method createSimpleContainer.
@Test
public void createSimpleContainer() {
SimpleJmsListenerContainerFactory factory = new SimpleJmsListenerContainerFactory();
setDefaultJmsConfig(factory);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
SimpleMessageListenerContainer container = factory.createListenerContainer(endpoint);
assertDefaultJmsConfig(container);
assertThat(container.getMessageListener()).isEqualTo(messageListener);
assertThat(container.getDestinationName()).isEqualTo("myQueue");
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-framework by spring-projects.
the class AbstractJmsAnnotationDrivenTests method testJmsHandlerMethodFactoryConfiguration.
/**
* Test for {@link ValidationBean} with a validator ({@link TestValidator}) specified
* in a custom {@link org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory}.
*
* The test should throw a {@link org.springframework.jms.listener.adapter.ListenerExecutionFailedException}
*/
protected void testJmsHandlerMethodFactoryConfiguration(ApplicationContext context) throws JMSException {
JmsListenerContainerTestFactory simpleFactory = context.getBean("defaultFactory", JmsListenerContainerTestFactory.class);
assertThat(simpleFactory.getListenerContainers().size()).isEqualTo(1);
MethodJmsListenerEndpoint endpoint = (MethodJmsListenerEndpoint) simpleFactory.getListenerContainers().get(0).getEndpoint();
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
endpoint.setupListenerContainer(container);
MessagingMessageListenerAdapter listener = (MessagingMessageListenerAdapter) container.getMessageListener();
listener.onMessage(new StubTextMessage("failValidation"), mock(Session.class));
}
Aggregations