Skip to content

How to relate ack_ids and messages in subscription::get_messages result? #14

@hseeberger

Description

@hseeberger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions