ygndotgg commented on code in PR #4735:
URL: https://github.com/apache/iggy/pull/4735#discussion_r4485505734


##########
core/connectors/sources/rabbitmq_source/src/lib.rs:
##########
@@ -0,0 +1,919 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+pub mod config;
+pub mod driver;
+pub mod message;
+
+pub mod batch {
+    use iggy_connector_sdk::{Error, ProducedMessage, ProducedMessages, Schema};
+    use lapin::{Acker, options::BasicAckOptions};
+
+    pub struct PendingBatch {
+        schema: Schema,
+        deliveries: Vec<(ProducedMessage, Acker)>,
+        in_flight: bool,
+    }
+
+    impl PendingBatch {
+        pub fn new(schema: Schema, deliveries: Vec<(ProducedMessage, Acker)>) 
-> Self {
+            Self {
+                schema,
+                deliveries,
+                in_flight: false,
+            }
+        }
+
+        pub fn next_attempt(&mut self) -> Option<ProducedMessages> {
+            if self.in_flight {
+                return None;
+            }
+            self.in_flight = true;
+            // Keep the originals and their ackers for replay if the runtime 
returns a NACK.
+            Some(ProducedMessages {
+                schema: self.schema,
+                messages: self
+                    .deliveries
+                    .iter()
+                    .map(|(message, _)| ProducedMessage {
+                        id: message.id,
+                        checksum: message.checksum,
+                        timestamp: message.timestamp,
+                        origin_timestamp: message.origin_timestamp,
+                        headers: message.headers.clone(),
+                        payload: message.payload.clone(),
+                    })
+                    .collect(),
+                state: None,

Review Comment:
   I documented that exactly_once = true is unsupported and set it to false in 
the examples. This is only a warning; the runtime still accepts true.Rejecting 
the mode requires runtime support because the runtime owns the setting, 
   Supporting exactly-once delivery needs a separate recovery design. RabbitMQ 
can redeliver messages after a restart, so the design must recognize those 
redeliveries and prevent duplicate writes to Iggy. Until then, duplicates 
remain possible under the current at-least-once contract.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to