-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for moving failed messages to deadletter queue in Redis. The queue can be re-driven via an undocumented endpoint, `/api/v1/admin/redrive-dlq`.
- Loading branch information
1 parent
76d9e35
commit b82f9ff
Showing
9 changed files
with
197 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use aide::{ | ||
axum::{routing::post_with, ApiRouter}, | ||
transform::TransformPathItem, | ||
}; | ||
use axum::extract::State; | ||
use svix_server_derive::aide_annotate; | ||
|
||
use crate::{core::permissions, error::Result, v1::utils::NoContent, AppState}; | ||
|
||
/// Redrive DLQ | ||
#[aide_annotate(op_id = "v1.admin.redrive-dlq")] | ||
pub async fn redrive_dlq( | ||
State(AppState { queue_tx, .. }): State<AppState>, | ||
_: permissions::Organization, | ||
) -> Result<NoContent> { | ||
if let Err(e) = queue_tx.redrive_dlq().await { | ||
tracing::warn!(error = ?e, "DLQ redrive failed"); | ||
} | ||
Ok(NoContent) | ||
} | ||
|
||
pub fn router() -> ApiRouter<AppState> { | ||
ApiRouter::new().api_route_with( | ||
"/admin/redrive-dlq", | ||
post_with(redrive_dlq, redrive_dlq_operation), | ||
move |op: TransformPathItem<'_>| op.tag("Admin".as_ref()).hidden(true), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.