mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix(sqs): add SenderId and ApproximateFirstReceiveTimestamp to Lambda event records (#726)
This commit is contained in:
1 parent
860e35f6af
commit
9c3f263aa0
3 files changed
+97
-3
No files matched your search
@@ -212,7 +212,7 @@ public class SqsEventSourcePoller {
|
||||
}
|
||||
}
|
||||
|
||||
private String buildSqsEvent(List<Message> messages, EventSourceMapping esm) {
|
||||
String buildSqsEvent(List<Message> messages, EventSourceMapping esm) {
|
||||
try {
|
||||
var records = objectMapper.createArrayNode();
|
||||
for (Message msg : messages) {
|
||||
@@ -222,7 +222,9 @@ public class SqsEventSourcePoller {
|
||||
record.put("body", msg.getBody());
|
||||
ObjectNode attrs = record.putObject("attributes");
|
||||
attrs.put("ApproximateReceiveCount", String.valueOf(msg.getReceiveCount()));
|
||||
attrs.put("SentTimestamp", String.valueOf(System.currentTimeMillis()));
|
||||
attrs.put("SentTimestamp", String.valueOf(msg.getSentTimestamp().toEpochMilli()));
|
||||
attrs.put("SenderId", AwsArnUtils.accountOrDefault(esm.getEventSourceArn(), "000000000000"));
|
||||
attrs.put("ApproximateFirstReceiveTimestamp", String.valueOf(System.currentTimeMillis()));
|
||||
record.putObject("messageAttributes");
|
||||
record.put("md5OfBody", msg.getMd5OfBody() != null ? msg.getMd5OfBody() : "");
|
||||
record.put("eventSource", "aws:sqs");
|
||||
|
||||
@@ -404,7 +404,9 @@ public class PipesPoller {
|
||||
record.put("body", msg.getBody());
|
||||
ObjectNode attrs = record.putObject("attributes");
|
||||
attrs.put("ApproximateReceiveCount", String.valueOf(msg.getReceiveCount()));
|
||||
attrs.put("SentTimestamp", String.valueOf(System.currentTimeMillis()));
|
||||
attrs.put("SentTimestamp", String.valueOf(msg.getSentTimestamp().toEpochMilli()));
|
||||
attrs.put("SenderId", AwsArnUtils.accountOrDefault(pipe.getSource(), "000000000000"));
|
||||
attrs.put("ApproximateFirstReceiveTimestamp", String.valueOf(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