From dff4741d3622f74475750c683ccbc5ec78058d0a Mon Sep 17 00:00:00 2001 From: Hiren Patel <80465571+hirenkp2000@users.noreply.github.com> Date: Wed, 11 Sep 2024 00:17:11 +0530 Subject: [PATCH] fixed sns msg id (#341) * Updated v1 pipeline rules (#309) * Updated deployment group for E2E env * V1 branch rules updated (#308) * Updated deployment group for E2E env (#305) * updated rules as per v1_* branches * 1.1.2 fixing SNS publish batch-size issue (#339) * Updated deployment group for E2E env * V1 branch rules updated (#308) * Updated deployment group for E2E env (#305) * updated rules as per v1_* branches * Fixed SNS publish batch-size issue * debug pipeline failure * include hidden file in artifact * Fixed SNS publish batch-size issue * fixed sns publish msg id --- .../xyz/pub/impl/DefaultSNSBatchPublisher.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/xyz-txn-handler/src/main/java/com/here/xyz/pub/impl/DefaultSNSBatchPublisher.java b/xyz-txn-handler/src/main/java/com/here/xyz/pub/impl/DefaultSNSBatchPublisher.java index 14f568703..9ab1b4247 100644 --- a/xyz-txn-handler/src/main/java/com/here/xyz/pub/impl/DefaultSNSBatchPublisher.java +++ b/xyz-txn-handler/src/main/java/com/here/xyz/pub/impl/DefaultSNSBatchPublisher.java @@ -63,15 +63,8 @@ public void publishTransactions(final PubConfig pubCfg, final Subscription sub, final int msgLength = msg.length(); final Map msgAttrMap = populateMessageAttributeMap(txnData, sub, spaceId); - // Prepare PublishBatchEntry for current message - final PublishBatchRequestEntry batchEntry = PublishBatchRequestEntry.builder() - .message(msg) - .messageAttributes(msgAttrMap) - .id(MSG_ID_PREFIX + batchEntryCounter) - .build(); - - // publish batch if payload limit reached - if (msgLength+aggrBatchPayloadSize > MAX_ALLOWED_PAYLOAD_SIZE && batchEntries.size()>0) { + // publish accumulated batch if payload limit reached + if (msgLength+aggrBatchPayloadSize > MAX_ALLOWED_PAYLOAD_SIZE && !batchEntries.isEmpty()) { // publish current batch publishBatchEntriesAndCheckResult(batchEntries, snsTopic, snsClient, txnList, subId, publishedRecCnt, MSG_ID_PREFIX, pubCfg, pubDTO); // update batch variables @@ -81,6 +74,12 @@ public void publishTransactions(final PubConfig pubCfg, final Subscription sub, batchEntryCounter = 0; } + // Prepare PublishBatchEntry for current message + final PublishBatchRequestEntry batchEntry = PublishBatchRequestEntry.builder() + .message(msg) + .messageAttributes(msgAttrMap) + .id(MSG_ID_PREFIX + batchEntryCounter) + .build(); // add current message to the batch batchEntries.add(batchEntry); aggrBatchPayloadSize += msgLength;