-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Description
I would like to do something like this in my application code:
pub struct FetchedMessage {
pub message: Message<MessagePayload>,
pub is_priority: bool,
}
#[async_trait]
impl PulsarConnection for TestPulsarConnection {
async fn fetch(&self) -> Result<Option<FetchedMessage>, pulsar::Error> {}
async fn ack(&self, message: FetchedMessage) -> Result<(), ConsumerError> {
panic!()
}
async fn nack(&self, message: FetchedMessage) -> Result<(), ConsumerError> {
panic!();
}
async fn shutdown(&self, worker_shutdown: impl Future<Output = ()> + Send) {}
}
In my tests, so I could stub out all of the pulsar connection code from my unit tests and test some rare cases.
However, I can not do this because this is the type returned by the pulsar consumer APIs:
https://github.com/streamnative/pulsar-rs/blob/master/src/consumer/message.rs#L9-L20
There is no way to construct it, as it both:
- Does not have a public construction function
- Contains a field that is not public (_phantom)
Could we possible relax one of these two constraints so I can write my tests?
Metadata
Metadata
Assignees
Labels
No labels