mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(eventbridge): keep persisted rules from disappearing on reload (#878)
Rule.getRegion() is a derived getter (computed from the rule's ARN) but has no matching setter. When EventBridgeService runs in any non-memory storage mode, PersistentStorage's ObjectMapper writes "region" into eventbridge-rules.json on save, then throws UnrecognizedPropertyException on the next startup because Rule cannot deserialize it. The exception is swallowed by PersistentStorage.load(), so the rule store comes up empty and every PutRule made before the restart silently disappears. Two changes on Rule: - @JsonIgnore on getRegion() so the derived field is no longer written to disk. - @JsonIgnoreProperties(ignoreUnknown = true) on the class to match the convention used by Target, InputTransformer, SqsParameters and most other persisted models, and to let a file that includes "region" (written before this change) still load cleanly after upgrade. Adds RulePersistenceTest covering the PersistentStorage round-trip and unknown-property tolerance.
This commit is contained in:
1 parent
70e61dcbda
commit
ff80dac780
2 files changed
+88
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.eventbridge.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
@@ -8,6 +10,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RegisterForReflection
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Rule {
|
||||
|
||||
private String name;
|
||||
@@ -57,6 +60,7 @@ public class Rule {
|
||||
public Instant getCreatedAt() { return createdAt; }
|
||||
public void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; }
|
||||
|
||||
@JsonIgnore
|
||||
public String getRegion() {
|
||||
return AwsArnUtils.regionOrDefault(arn, null);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user