This is an automated email from the ASF dual-hosted git repository.

piotr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new e06e6ec6 fix(server): assign random id to each message for binary 
clients (#1665)
e06e6ec6 is described below

commit e06e6ec698cbe460e2ce184b9aada8f1a4632e5b
Author: Grzegorz Koszyk <[email protected]>
AuthorDate: Fri Mar 28 19:56:18 2025 +0100

    fix(server): assign random id to each message for binary clients (#1665)
    
    Bring back assignment of random id to each message for binary clients.
---
 server/src/binary/handlers/messages/send_messages_handler.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/src/binary/handlers/messages/send_messages_handler.rs 
b/server/src/binary/handlers/messages/send_messages_handler.rs
index a5d615dd..1b776238 100644
--- a/server/src/binary/handlers/messages/send_messages_handler.rs
+++ b/server/src/binary/handlers/messages/send_messages_handler.rs
@@ -20,6 +20,7 @@ use crate::binary::handlers::messages::COMPONENT;
 use crate::binary::sender::SenderKind;
 use crate::streaming::session::Session;
 use crate::streaming::systems::system::SharedSystem;
+use crate::streaming::utils::random_id;
 use anyhow::Result;
 use error_set::ErrContext;
 use iggy::error::IggyError;
@@ -37,7 +38,12 @@ pub async fn handle(
     let stream_id = command.stream_id.clone();
     let topic_id = command.topic_id.clone();
     let partitioning = command.partitioning.clone();
-    let messages = command.messages;
+    let mut messages = command.messages;
+    messages.iter_mut().for_each(|msg| {
+        if msg.id == 0 {
+            msg.id = random_id::get_uuid();
+        }
+    });
     // TODO(haze): Add confirmation level after testing is complete
     system
         .append_messages(session, stream_id, topic_id, partitioning, messages, 
None)

Reply via email to