Essentially, it's not clear to me how an application is supposed to recover when handling a nack or when langohr.confirm/wait-for-confirms returns false. It seems to me that the delivery tag that the nack handler receives is only useful if I've been maintaining a map from delivery tags to messages (so that I know which message needs to be retried). Is that a responsibility expected of the application developer? I.e., should I be doing something like (swap! delivery-tag->message assoc (.getNextPublishSeqNo channel) message) before each invocation of langohr.basic/publish? (If so, I'd probably also (swap! delivery-tag->message dissoc delivery-tag) inside of the ack-handler.)
And in the case of langohr.confirm/wait-for-confirms returning false: all I know in that circumstance is that some message failed to send since the last time I called wait-for-confirms. So in order to use wait-for-confirms, should I be maintaining a set of pending messages? Something along the lines of:
(if (wait-for-confirms channel)
(reset! sent-yet-unconfirmed-messages #{}) ; flush our memory of the recently-sent messages
(try-resending-the-messages))
I'd really appreciate any guidance you can provide.
-Josh Tilles
P.S. I'm new to AMQP, RabbitMQ, and Langohr, so if I'm going about this the wrong way, feel free to point it out.