Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't log whole message #74

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions crates/rabbitmq/src/consumer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! An AMQP consumer configured from a [`QueueType`]

use std::{io::Seek, marker::PhantomData};
use std::marker::PhantomData;

use futures_util::StreamExt;
use lapin::{acker::Acker, options::BasicNackOptions, Connection};
Expand Down Expand Up @@ -72,20 +72,13 @@ where
None => return Ok(None),
};

let mut data_cursor: std::io::Cursor<Vec<u8>> = std::io::Cursor::new(delivery.data);
let deser_result = deserialize(&mut data_cursor);
let data_cursor: std::io::Cursor<Vec<u8>> = std::io::Cursor::new(delivery.data);
let deser_result = deserialize(data_cursor);
if deser_result.is_err() {
delivery.acker.nack(BasicNackOptions::default()).await?;
if let Err(e) = data_cursor.seek(std::io::SeekFrom::Start(0)) {
log::error!(
"Failed to rewind cursor during Failed to deserialize message: {}",
e
);
}
log::error!(
"Failed to deserialize message: {:?}. Message is {:?}",
deser_result,
String::from_utf8(data_cursor.into_inner()),
"FATAL REAL BAD ERROR - Failed to deserialize message, will DLQ: {:?}.",
deser_result
);
}
deser_result
Expand Down
Loading