Virtual themes / queues and longevity

What happens to messages sent on a virtual topic when there are no listeners? Will the broker hold them for a certain time until the subscriber is available?

More specifically: In messages T0 and T1, messages M0 and M1 are sent. On T2, consumer C1 connects, will it receive M0 and M1? Obviously, messages M2 and M3 posted on T3 and T4 will be received by C1, but what will be the new consumer, C2, which connects to the T5 receiver? All messages, M2 and M3, or not?

+5
source share
3 answers

It depends on the nature of the topic: if the topic is durable (it has reliable consumers who subscribe to it), the broker will keep messages in the subject until all strong consumers spend messages. if the topic is not durable (there are no reliable consumers), the message will not even be sent on this topic, as there will be a long subscription.

In your example, I will assume that you are using reliable subscriptions / consumers: Case 1:

  • T-2 C1 and C2 provide a long-term theme subscription
  • Disabling T-1 C1 and C2
  • T0: M0 sent
  • T1: M1 sent
  • T2: C1 connects. C1 gets M0 and M1
  • T3: M3 sent. C1 gets M3
  • T4: M4 sent. C1 gets M4
  • T5: C2 connects, C2 gets M0, M1, M2, M3, M4

, /: , , . , ( / ). , , .

:

  • T-2 C1 C2
  • T-1 C1 C2
  • T0: M0
  • T1: M1
  • T2: C1 . C1
  • T3: M3 . C1 M3
  • T4: M4 . C1 M4
  • T5: C2 , C2
+4

, , , . - , - , "". "PERSISTENT", , .

+1

/ - :

M0 , C1 C2 ( ) ? , - .

0
source

All Articles