mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(eventbridge): persist and forward SqsParameters.MessageGroupId for FIFO SQS targets (#722) (#742)
EventBridgeHandler manually extracted only Id, Arn, Input, InputPath, and InputTransformer from the request JSON node — SqsParameters was never read. This meant the field was never stored, ListTargetsByRule never returned it, and EventBridgeInvoker called sendMessage without MessageGroupId, causing FIFO queue delivery to fail with: "The request must contain the parameter MessageGroupId." Fix: - Add SqsParameters model (messageGroupId field) - Add sqsParameters field to Target model - EventBridgeHandler.handlePutTargets: read SqsParameters node and set it on the target before storing - EventBridgeHandler.handleListTargetsByRule: write SqsParameters back into the response node when present - EventBridgeInvoker: pass messageGroupId to sendMessage() for SQS targets, enabling FIFO queue delivery Fixes #722
This commit is contained in:
1 parent
5d51052a51
commit
ccac5f63fd
5 files changed
+245
-1
No files matched your search
@@ -11,6 +11,7 @@ import io.github.hectorvent.floci.services.eventbridge.model.Replay;
|
||||
import io.github.hectorvent.floci.services.eventbridge.model.ReplayState;
|
||||
import io.github.hectorvent.floci.services.eventbridge.model.Rule;
|
||||
import io.github.hectorvent.floci.services.eventbridge.model.RuleState;
|
||||
import io.github.hectorvent.floci.services.eventbridge.model.SqsParameters;
|
||||
import io.github.hectorvent.floci.services.eventbridge.model.Target;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -207,6 +208,15 @@ public class EventBridgeHandler {
|
||||
String template = transformerNode.path("InputTemplate").asText(null);
|
||||
target.setInputTransformer(new InputTransformer(pathsMap, template));
|
||||
}
|
||||
JsonNode sqsParamsNode = t.path("SqsParameters");
|
||||
if (!sqsParamsNode.isMissingNode() && sqsParamsNode.isObject()) {
|
||||
String messageGroupId = sqsParamsNode.path("MessageGroupId").asText(null);
|
||||
if (messageGroupId != null) {
|
||||
SqsParameters sqsParameters = new SqsParameters();
|
||||
sqsParameters.setMessageGroupId(messageGroupId);
|
||||
target.setSqsParameters(sqsParameters);
|
||||
}
|
||||
}
|
||||
targets.add(target);
|
||||
}
|
||||
}
|
||||
@@ -261,6 +271,9 @@ public class EventBridgeHandler {
|
||||
transformerNode.put("InputTemplate", t.getInputTransformer().getInputTemplate());
|
||||
}
|
||||
}
|
||||
if (t.getSqsParameters() != null && t.getSqsParameters().getMessageGroupId() != null) {
|
||||
node.putObject("SqsParameters").put("MessageGroupId", t.getSqsParameters().getMessageGroupId());
|
||||
}
|
||||
targetsArray.add(node);
|
||||
}
|
||||
return Response.ok(response).build();
|
||||
|
||||
+3
-1
@@ -59,7 +59,9 @@ public class EventBridgeInvoker {
|
||||
LOG.debugv("EventBridge delivered to Lambda: {0}", arn);
|
||||
} else if (arn.contains(":sqs:")) {
|
||||
String queueUrl = AwsArnUtils.arnToQueueUrl(arn, baseUrl);
|
||||
sqsService.sendMessage(queueUrl, payload, 0);
|
||||
String messageGroupId = target.getSqsParameters() != null
|
||||
? target.getSqsParameters().getMessageGroupId() : null;
|
||||
sqsService.sendMessage(queueUrl, payload, 0, messageGroupId, null);
|
||||
LOG.debugv("EventBridge delivered to SQS: {0}", arn);
|
||||
} else if (arn.contains(":sns:")) {
|
||||
String topicRegion = extractRegionFromArn(arn, region);
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package io.github.hectorvent.floci.services.eventbridge.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class SqsParameters {
|
||||
|
||||
private String messageGroupId;
|
||||
|
||||
public SqsParameters() {}
|
||||
|
||||
public String getMessageGroupId() { return messageGroupId; }
|
||||
public void setMessageGroupId(String messageGroupId) { this.messageGroupId = messageGroupId; }
|
||||
}
|
||||
@@ -12,6 +12,7 @@ public class Target {
|
||||
private String input;
|
||||
private String inputPath;
|
||||
private InputTransformer inputTransformer;
|
||||
private SqsParameters sqsParameters;
|
||||
|
||||
public Target() {}
|
||||
|
||||
@@ -36,4 +37,7 @@ public class Target {
|
||||
|
||||
public InputTransformer getInputTransformer() { return inputTransformer; }
|
||||
public void setInputTransformer(InputTransformer inputTransformer) { this.inputTransformer = inputTransformer; }
|
||||
|
||||
public SqsParameters getSqsParameters() { return sqsParameters; }
|
||||
public void setSqsParameters(SqsParameters sqsParameters) { this.sqsParameters = sqsParameters; }
|
||||
}
|
||||
Reference in new issue
Block a user