Example usage for org.springframework.integration.support MutableMessageBuilder withPayload

List of usage examples for org.springframework.integration.support MutableMessageBuilder withPayload

Introduction

In this page you can find the example usage for org.springframework.integration.support MutableMessageBuilder withPayload.

Prototype

public static <T> MutableMessageBuilder<T> withPayload(T payload) 

Source Link

Document

Create a builder for a new Message instance with the provided payload.

Usage

From source file:org.springframework.integration.configuration.EnableIntegrationTests.java

@Test
public void testIntegrationConverter() {
    this.numberChannel.send(new GenericMessage<Integer>(10));
    this.numberChannel.send(new GenericMessage<Boolean>(true));
    assertThat(this.testConverter.getInvoked(), Matchers.greaterThan(0));

    assertTrue(this.bytesChannel.send(new GenericMessage<byte[]>("foo".getBytes())));
    assertTrue(this.bytesChannel.send(new GenericMessage<>(MutableMessageBuilder.withPayload("").build())));

}

From source file:org.springframework.integration.dsl.test.IntegrationFlowTests.java

@Test
public void testClaimCheck() {
    QueueChannel replyChannel = new QueueChannel();

    Message<String> message = MutableMessageBuilder.withPayload("foo").setReplyChannel(replyChannel).build();

    this.claimCheckInput.send(message);

    Message<?> receive = replyChannel.receive(2000);
    assertNotNull(receive);/*from  ww w .  j a va2s  . co  m*/
    assertSame(message, receive);

    assertEquals(1, this.messageStore.getMessageCount());
    assertSame(message, this.messageStore.getMessage(message.getHeaders().getId()));
}