Skip to content

Commit 65d9885

Browse files
committed
feat(trogon-source-linear): publish unroutable payloads to DLQ
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 430b2db commit 65d9885

5 files changed

Lines changed: 510 additions & 7 deletions

File tree

rsworkspace/Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rsworkspace/crates/trogon-source-linear/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ trogon-std = { workspace = true }
2626

2727
[dev-dependencies]
2828
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
29+
tower = "0.5"
30+
tracing-subscriber = { workspace = true }
31+
trogon-nats = { workspace = true, features = ["test-support"] }
2932
trogon-std = { workspace = true, features = ["test-support"] }
3033
testcontainers-modules = { version = "0.8", features = ["nats"] }
3134
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }

rsworkspace/crates/trogon-source-linear/src/constants.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ pub const DEFAULT_TIMESTAMP_TOLERANCE_SECS: u64 = 60;
99
/// Default JetStream ACK timeout: 10 seconds.
1010
pub const DEFAULT_NATS_ACK_TIMEOUT_MS: u64 = 10_000;
1111
pub const DEFAULT_NATS_CONNECT_TIMEOUT: Duration = Duration::from_secs(10);
12+
13+
pub const NATS_HEADER_REJECT_REASON: &str = "X-Linear-Reject-Reason";

rsworkspace/crates/trogon-source-linear/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
//! - **Headers**: `Nats-Msg-Id` (set to Linear's `webhookId` for dedup)
1818
//! - **Payload**: raw JSON body from Linear
1919
//!
20+
//! Payloads that pass signature verification but fail validation (invalid JSON,
21+
//! missing/invalid `type` or `action`, stale timestamp) are published to
22+
//! `{LINEAR_SUBJECT_PREFIX}.unroutable` with an `X-Linear-Reject-Reason` header.
23+
//!
2024
//! ## Configuration (env vars)
2125
//!
2226
//! | Variable | Default | Description |

0 commit comments

Comments
 (0)