If I use the SendBatch method in MassTransit and for whatever reason some of the messages fail to be acknowledged I cant see an apparent way to figure out which ones they were.
One case where that might happen is if my max queue length is say 7 and its configured to reject new messages when full. And I try to send 10 messages using SendBatch, it successfully sends 7 messages then the rest of them fail. But it only throws the MassTransit.MessageNotAcknowledgedException exception and I cant see any information regarding which messages failed to be sent. I'm sure there can be other cases where SendBatch partially fails. How do I extract the failure information from it? It only returns a Task as stated in the docs: The task which is completed once the Send is acknowledged by the broker
The only workaround I can see right now is to not use send batch, and instead use the regular send method and iterate over the messages in c# myself and handle the failing ones manually.
You are correct, the only solution is to enumerable the batch of messages you're sending, and send them storing the returned Task
in an array. And then, if you want to check each message to see if it was sent, you can verify the Task was completed.
I'd be worried that you have other problems in your system if you're worried about available queue depth, however.