Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cf-dev] Don't send Ack if MessageObserver throws

Hi all,

I took a look at ReliabilityLayer::receiveResponse and it seems that the ack is sent to the sender before the MessageObservers are called with the response.
Wouldn't it make sense to allow the MessageObservers to throw an exception if they can't handle a response, so that the Ack is not sent?

This would make sense if for example the response should be stored to a database. If the MessageObserver cannot reach the database then it can't store the request, and it will potentially be lost. Now if the message was not acked, the device could resend it, and maybe another service instance could pick up the next response, successfully storing it.

Do you think that makes sense?

Just put upper().receiveResponse() in a try block, then send the ack after that command has successfully completed

Cheers,
Martin

Back to the top