In subscription::get_messages the ack_ids are decoupled from the converted messages, since the function returns two vectors.
let messages = response.received_messages.unwrap_or_default();
let ack_ids: Vec<String> = messages
.as_slice()
.iter()
.map(|packet| packet.ack_id.clone())
.collect();
let packets = messages
.into_iter()
.filter_map(|packet| match T::from(packet.message) {
Ok(o) => Some(o),
Err(e) => {
error!("Failed converting pubsub {}", e,);
None
}
})
.collect();
Ok((packets, ack_ids))
If messages cannot be converted, they are dropped. So how would I know which ack_id is for which message? On the happy path the are correlated by index, but if some messages are dropped, that is no longer the case.
In
subscription::get_messages
theack_id
s are decoupled from the converted messages, since the function returns two vectors.If messages cannot be converted, they are dropped. So how would I know which
ack_id
is for whichmessage
? On the happy path the are correlated by index, but if some messages are dropped, that is no longer the case.