@Test void receiveMessage_withNumericMessageHeaders_shouldBeReceivedAsQueueMessageAttributes() throws Exception { AmazonSQSAsync amazonSqs = mock(AmazonSQSAsync.class); HashMap<String, MessageAttributeValue> messageAttributes = new HashMap<>(); double doubleValue = 1234.56; messageAttributes.put("double", new MessageAttributeValue() .withDataType( MessageAttributeDataTypes.NUMBER + ".java.lang.Double") .withStringValue(String.valueOf(doubleValue))); long longValue = 1234L; messageAttributes.put("long", new MessageAttributeValue() .withDataType( MessageAttributeDataTypes.NUMBER + ".java.lang.Long") .withStringValue(String.valueOf(longValue))); int integerValue = 1234; messageAttributes.put("integer", new MessageAttributeValue() .withDataType( MessageAttributeDataTypes.NUMBER + ".java.lang.Integer") .withStringValue(String.valueOf(integerValue))); byte byteValue = 2; messageAttributes.put("byte", new MessageAttributeValue() .withDataType( MessageAttributeDataTypes.NUMBER + ".java.lang.Byte") .withStringValue(String.valueOf(byteValue))); short shortValue = 12; messageAttributes.put("short", new MessageAttributeValue() .withDataType( MessageAttributeDataTypes.NUMBER + ".java.lang.Short") .withStringValue(String.valueOf(shortValue))); float floatValue = 1234.56f; messageAttributes.put("float", new MessageAttributeValue() .withDataType( MessageAttributeDataTypes.NUMBER + ".java.lang.Float") .withStringValue(String.valueOf(floatValue))); BigInteger bigIntegerValue = new BigInteger("616416546156"); messageAttributes.put("bigInteger", new MessageAttributeValue() .withDataType(MessageAttributeDataTypes.NUMBER + ".java.math.BigInteger") .withStringValue(String.valueOf(bigIntegerValue))); BigDecimal bigDecimalValue = new BigDecimal("7834938"); messageAttributes.put("bigDecimal", new MessageAttributeValue() .withDataType(MessageAttributeDataTypes.NUMBER + ".java.math.BigDecimal") .withStringValue(String.valueOf(bigDecimalValue))); 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(messageAttributes))); PollableChannel messageChannel = new QueueMessageChannel(amazonSqs, "http: Message<?> receivedMessage = messageChannel.receive(); assertThat(receivedMessage.getHeaders().get("double")).isEqualTo(doubleValue); assertThat(receivedMessage.getHeaders().get("long")).isEqualTo(longValue); assertThat(receivedMessage.getHeaders().get("integer")).isEqualTo(integerValue); assertThat(receivedMessage.getHeaders().get("byte")).isEqualTo(byteValue); assertThat(receivedMessage.getHeaders().get("short")).isEqualTo(shortValue); assertThat(receivedMessage.getHeaders().get("float")).isEqualTo(floatValue); assertThat(receivedMessage.getHeaders().get("bigInteger")) .isEqualTo(bigIntegerValue); assertThat(receivedMessage.getHeaders().get("bigDecimal")) .isEqualTo(bigDecimalValue); }
@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);  }