Handle cases where a message might be missing a destination UUID

This commit is contained in:
Jon Chambers 2021-12-02 14:00:11 -05:00 committed by Jon Chambers
parent 62aa0cef39
commit 9c62622733
1 changed files with 7 additions and 2 deletions

View File

@ -86,8 +86,13 @@ public class MessagesDynamoDb extends AbstractDynamoDbStore {
.put(LOCAL_INDEX_MESSAGE_UUID_KEY_SORT, convertLocalIndexMessageUuidSortKey(messageUuid))
.put(KEY_TYPE, AttributeValues.fromInt(message.getType().getNumber()))
.put(KEY_TIMESTAMP, AttributeValues.fromLong(message.getTimestamp()))
.put(KEY_TTL, AttributeValues.fromLong(getTtlForMessage(message)))
.put(KEY_DESTINATION_UUID, AttributeValues.fromUUID(UUID.fromString(message.getDestinationUuid())));
.put(KEY_TTL, AttributeValues.fromLong(getTtlForMessage(message)));
// TODO All messages should have a destination UUID by 2021-12-03, and this can be set unconditionally
if (message.hasDestinationUuid()) {
item.put(KEY_DESTINATION_UUID, AttributeValues.fromUUID(UUID.fromString(message.getDestinationUuid())));
}
if (message.hasRelay() && message.getRelay().length() > 0) {
item.put(KEY_RELAY, AttributeValues.fromString(message.getRelay()));
}