Example usage for org.springframework.integration.aggregator BarrierMessageHandler setRequiresReply

List of usage examples for org.springframework.integration.aggregator BarrierMessageHandler setRequiresReply

Introduction

In this page you can find the example usage for org.springframework.integration.aggregator BarrierMessageHandler setRequiresReply.

Prototype

public void setRequiresReply(boolean requiresReply) 

Source Link

Document

Flag whether a reply is required.

Usage

From source file:org.springframework.integration.aggregator.BarrierMessageHandlerTests.java

@Test
public void testRequiresReply() throws Exception {
    final BarrierMessageHandler handler = new BarrierMessageHandler(0);
    QueueChannel outputChannel = new QueueChannel();
    handler.setOutputChannel(outputChannel);
    handler.setBeanFactory(mock(BeanFactory.class));
    handler.setRequiresReply(true);
    handler.afterPropertiesSet();/*w w w.j a  v  a 2 s  . c o  m*/
    try {
        handler.handleMessage(MessageBuilder.withPayload("foo").setCorrelationId("foo").build());
        fail("exception expected");
    } catch (Exception e) {
        assertThat(e, Matchers.instanceOf(ReplyRequiredException.class));
    }
}