diff --git a/spring-cloud-aws-sns/src/main/java/io/awspring/cloud/sns/core/TopicMessageChannel.java b/spring-cloud-aws-sns/src/main/java/io/awspring/cloud/sns/core/TopicMessageChannel.java index 22e9d50cf..4e9eed44a 100644 --- a/spring-cloud-aws-sns/src/main/java/io/awspring/cloud/sns/core/TopicMessageChannel.java +++ b/spring-cloud-aws-sns/src/main/java/io/awspring/cloud/sns/core/TopicMessageChannel.java @@ -103,7 +103,7 @@ else if (MessageHeaders.ID.equals(messageHeaderName) && messageHeaderValue != nu messageAttributes.put(messageHeaderName, getStringMessageAttribute(messageHeaderValue.toString())); } else if (MessageHeaders.TIMESTAMP.equals(messageHeaderName) && messageHeaderValue != null) { - messageAttributes.put(messageHeaderName, getNumberMessageAttribute(messageHeaderValue)); + messageAttributes.put(messageHeaderName, getDetailedNumberMessageAttribute(messageHeaderValue)); } else if (messageHeaderValue instanceof String) { messageAttributes.put(messageHeaderName, getStringMessageAttribute((String) messageHeaderValue)); diff --git a/spring-cloud-aws-sns/src/test/java/io/awspring/cloud/sns/core/TopicMessageChannelTest.java b/spring-cloud-aws-sns/src/test/java/io/awspring/cloud/sns/core/TopicMessageChannelTest.java index d47fe208b..3c0009ae0 100644 --- a/spring-cloud-aws-sns/src/test/java/io/awspring/cloud/sns/core/TopicMessageChannelTest.java +++ b/spring-cloud-aws-sns/src/test/java/io/awspring/cloud/sns/core/TopicMessageChannelTest.java @@ -66,6 +66,7 @@ void sendMessage_validTextMessageAndSubject_returnsTrue() throws Exception { assertThat(it.topicArn()).isEqualTo(TOPIC_ARN); assertThat(it.message()).isEqualTo("Message content"); assertThat(it.messageAttributes()).containsKeys(MessageHeaders.ID, MessageHeaders.TIMESTAMP); + assertThat(it.messageAttributes().get(MessageHeaders.TIMESTAMP).dataType()).isEqualTo("Number.java.lang.Long"); assertThat(it.messageAttributes()).doesNotContainKey(NOTIFICATION_SUBJECT_HEADER); })); assertThat(sent).isTrue();