mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(lambda): use persisted firstReceiveTimestamp in SQS ESM (#1548)
* fix: return XML error for missing action and add volume action fallbacks * fix(eventbridge): sync EventBridge tags to ResourceGroupsTaggingService EventBridge stored tags on rules, buses, and archives in its own stores but never propagated them to the central ResourceGroupsTaggingService. This caused GetResources with --resource-type-filters events:rule to return an empty list. Inject ResourceGroupsTaggingService into EventBridgeService (following the existing GlueService pattern) and sync tags during putRule, tagResource, untagResource, and deleteRule operations. Closes #1343 * fix(lambda): use persisted firstReceiveTimestamp in SQS ESM and Pipes event payloads Both SqsEventSourcePoller.buildSqsEvent() and PipesPoller.buildSqsRecordNodes() were using System.currentTimeMillis() for ApproximateFirstReceiveTimestamp, causing the value to change on every poll cycle. AWS SQS defines this as the epoch time when the message was first received from the queue, and it must remain constant across retries. The SQS service layer already tracks this correctly via Message.firstReceiveTimestamp (set once in GuardedMessageQueue.tryClaim()), but both pollers bypassed the stored value. Changes: - SqsEventSourcePoller: read msg.getFirstReceiveTimestamp() with null fallback - PipesPoller: same fix for the identical code path - SqsEventSourcePollerTest: set firstReceiveTimestamp on test messages and assert the output matches the stored value; add a regression test proving the timestamp remains stable across simulated retries Closes #1497 --------- Signed-off-by: Hector Ventura <hectorvent@gmail.com> Co-authored-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
1a319551cc
commit
952dec060f
3 files changed
+40
-2
No files matched your search
@@ -284,7 +284,10 @@ public class SqsEventSourcePoller {
|
||||
attrs.put("ApproximateReceiveCount", String.valueOf(msg.getReceiveCount()));
|
||||
attrs.put("SentTimestamp", String.valueOf(msg.getSentTimestamp().toEpochMilli()));
|
||||
attrs.put("SenderId", AwsArnUtils.accountOrDefault(esm.getEventSourceArn(), "000000000000"));
|
||||
attrs.put("ApproximateFirstReceiveTimestamp", String.valueOf(System.currentTimeMillis()));
|
||||
attrs.put("ApproximateFirstReceiveTimestamp",
|
||||
String.valueOf(msg.getFirstReceiveTimestamp() != null
|
||||
? msg.getFirstReceiveTimestamp().toEpochMilli()
|
||||
: System.currentTimeMillis()));
|
||||
if (msg.getSequenceNumber() > 0) {
|
||||
attrs.put("SequenceNumber", String.valueOf(msg.getSequenceNumber()));
|
||||
}
|
||||
|
||||
@@ -410,7 +410,10 @@ public class PipesPoller {
|
||||
attrs.put("ApproximateReceiveCount", String.valueOf(msg.getReceiveCount()));
|
||||
attrs.put("SentTimestamp", String.valueOf(msg.getSentTimestamp().toEpochMilli()));
|
||||
attrs.put("SenderId", AwsArnUtils.accountOrDefault(pipe.getSource(), "000000000000"));
|
||||
attrs.put("ApproximateFirstReceiveTimestamp", String.valueOf(System.currentTimeMillis()));
|
||||
attrs.put("ApproximateFirstReceiveTimestamp",
|
||||
String.valueOf(msg.getFirstReceiveTimestamp() != null
|
||||
? msg.getFirstReceiveTimestamp().toEpochMilli()
|
||||
: System.currentTimeMillis()));
|
||||
ObjectNode msgAttrs = record.putObject("messageAttributes");
|
||||
for (Map.Entry<String, MessageAttributeValue> entry : msg.getMessageAttributes().entrySet()) {
|
||||
ObjectNode attrNode = msgAttrs.putObject(entry.getKey());
|
||||
|
||||
Reference in new issue
Block a user