use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class DirectChannelSubscriptionTests method exceptionThrownFromRegisteredEndpoint.
@Test(expected = MessagingException.class)
public void exceptionThrownFromRegisteredEndpoint() {
AbstractReplyProducingMessageHandler handler = new AbstractReplyProducingMessageHandler() {
@Override
public Object handleRequestMessage(Message<?> message) {
throw new RuntimeException("intentional test failure");
}
};
handler.setOutputChannel(targetChannel);
EventDrivenConsumer endpoint = new EventDrivenConsumer(sourceChannel, handler);
context.registerEndpoint("testEndpoint", endpoint);
context.refresh();
try {
this.sourceChannel.send(new GenericMessage<String>("foo"));
} finally {
context.stop();
}
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class DefaultSplitterTests method correlationIdCopiedFromMessageId.
@Test
public void correlationIdCopiedFromMessageId() {
Message<String> message = MessageBuilder.withPayload("test").build();
DirectChannel inputChannel = new DirectChannel();
QueueChannel outputChannel = new QueueChannel(1);
DefaultMessageSplitter splitter = new DefaultMessageSplitter();
splitter.setOutputChannel(outputChannel);
EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, splitter);
endpoint.start();
assertTrue(inputChannel.send(message));
Message<?> reply = outputChannel.receive(0);
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class JmsOutboundChannelAdapterParserTests method adapterWithHeaderMapper.
@Test
public void adapterWithHeaderMapper() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsOutboundWithHeaderMapper.xml", this.getClass());
EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("adapter");
DirectFieldAccessor accessor = new DirectFieldAccessor(new DirectFieldAccessor(endpoint).getPropertyValue("handler"));
JmsHeaderMapper headerMapper = (JmsHeaderMapper) accessor.getPropertyValue("headerMapper");
assertNotNull(headerMapper);
assertEquals(TestJmsHeaderMapper.class, headerMapper.getClass());
context.close();
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class JmsOutboundChannelAdapterParserTests method adapterWithJmsTemplateQos.
@Test
public void adapterWithJmsTemplateQos() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsOutboundWithJmsTemplateQos.xml", this.getClass());
EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("adapter");
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(new DirectFieldAccessor(endpoint).getPropertyValue("handler"));
JmsTemplate jmsTemplate = (JmsTemplate) handlerAccessor.getPropertyValue("jmsTemplate");
assertNotNull(jmsTemplate);
assertEquals(context.getBean("template"), jmsTemplate);
assertTrue(jmsTemplate.isExplicitQosEnabled());
assertEquals(7, jmsTemplate.getPriority());
assertEquals(12345, jmsTemplate.getTimeToLive());
context.close();
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class JmsOutboundChannelAdapterParserTests method qosNotExplicitByDefault.
@Test
public void qosNotExplicitByDefault() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsOutboundWithQos.xml", this.getClass());
EventDrivenConsumer endpoint = context.getBean("defaultAdapter", EventDrivenConsumer.class);
DirectFieldAccessor accessor = new DirectFieldAccessor(new DirectFieldAccessor(new DirectFieldAccessor(endpoint).getPropertyValue("handler")).getPropertyValue("jmsTemplate"));
assertEquals(false, accessor.getPropertyValue("explicitQosEnabled"));
context.close();
}
Aggregations