Skip to content

Commit

Permalink
Set more detailed data type on "timestamp" attribute in SNS message.
Browse files Browse the repository at this point in the history
Mainly due to keeping backward compatibility with Spring Cloud AWS 2.x

Fixes #791
  • Loading branch information
maciejwalkowiak committed Oct 30, 2023
1 parent fa49503 commit adfe19b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit adfe19b

Please sign in to comment.