How long does temporary queue last after client disconnects?

radekm
radekm Member Posts: 23

Hi.

I would like to use temporary queues to make a client more robust so even if the client disconnects for a short period of time it won't lose any messages thanks to the queue.

It's also desirable that temporary queues are destroyed if the client doesn't reconnect so too old messages don't waste space of the broker.

Unfortunately I'm unable to detect whether temporary queue was destroyed and then recreated after reconnect (and messages were lost) or not.

Can I configure time after which temporary queue is destroyed or detect that queue was recreated when flow reconnected?

Thanks

Answers

  • radekm
    radekm Member Posts: 23

    I found some solution. According to Reapplying Subscriptions on Reconnect

    If a client is using a Temporary Queue and disconnects for over a minute, the Temporary Queue will be removed from the event broker, and automatically recreated once the client reconnects. However, the subscription will not be re-applied even if REAPPLY_SUBSCRIPTIONS is enabled.

    my temporary queue won't have any subscriptions if it was recreated.

    So I'll initially add dummy subscription immediately after creating a flow. Then after reconnect I can try adding the dummy subscription again and if I get error SubscriptionAlreadyPresent then I know for sure that the queue wasn't destroyed.

    With this solution I could still lose messages because they don't fit into the queue because of small quota.

    Wondering whether there's a better solution?