@Test void receiveMessage_withBinaryMessageHeader_shouldBeReceivedAsByteBufferMessageAttribute() throws Exception { AmazonSQSAsync amazonSqs = mock(AmazonSQSAsync.class); ByteBuffer headerValue = ByteBuffer.wrap("My binary data!".getBytes()); String headerName = "MyHeader"; when(amazonSqs.receiveMessage(new ReceiveMessageRequest("http: .withWaitTimeSeconds(0).withMaxNumberOfMessages(1) .withAttributeNames(QueueMessageChannel.ATTRIBUTE_NAMES) .withMessageAttributeNames("All"))) .thenReturn(new ReceiveMessageResult().withMessages( new com.amazonaws.services.sqs.model.Message() .withBody("Hello") .withMessageAttributes(Collections.singletonMap( headerName, new MessageAttributeValue().withDataType( MessageAttributeDataTypes.BINARY) .withBinaryValue(headerValue))))); PollableChannel messageChannel = new QueueMessageChannel(amazonSqs, "http: Message<?> receivedMessage = messageChannel.receive(); assertThat(receivedMessage.getHeaders().get(headerName)).isEqualTo(headerValue); }
@Override public Message<String> receive() { return this.receive(0); }
QueueMessageChannel extends AbstractMessageChannel implements PollableChannel { @Override public Message<String> receive() { return this.receive(0); } }
QueueMessageChannel extends AbstractMessageChannel implements PollableChannel { @Override public Message<String> receive() { return this.receive(0); } QueueMessageChannel(AmazonSQSAsync amazonSqs, String queueUrl); }
QueueMessageChannel extends AbstractMessageChannel implements PollableChannel { @Override public Message<String> receive() { return this.receive(0); } QueueMessageChannel(AmazonSQSAsync amazonSqs, String queueUrl); @Override Message<String> receive(); @Override Message<String> receive(long timeout); }
QueueMessageChannel extends AbstractMessageChannel implements PollableChannel { @Override public Message<String> receive() { return this.receive(0); } QueueMessageChannel(AmazonSQSAsync amazonSqs, String queueUrl); @Override Message<String> receive(); @Override Message<String> receive(long timeout);  }