0

We are using Azure Service Bus Topic in workflow manager (approval process). In any way, we don’t want to lose/duplicate messages when we push messages to service bus topic. Now there are two options. a. Use Retry the only b. Use Paired service bus only without retry. As we cannot use both together, let assume during message push, primary service bus is not available then message pus to paired service bus and when primary service bus available then automatically message push to the primary. But if we use retry, retry will try to push message to primary and as primary service bus is not available messages will go to paired service bus also. so there are chances to process duplicate messages.

Which is the best option “a” or “b”, to push message to service bus for the given problem statement?

  • Are you referring to Paired Namespaces feature? If yes, paired namespace is solely used as a temporary storage while the primary namespace is down. It is not used to process messages. – Sean Feldman Apr 05 '18 at 03:20
  • @SeanFeldman Yes, Paired namespaces, I know it will not process a message. once primary service bus is available then secondary push message to primary one. in case "a" and "b" which is most suitable approach to push message to Primary service bus ? – Rukhsar Ahmad Apr 05 '18 at 05:49
  • I'm not a big fan of PairedNamespace. Will leave an answer. – Sean Feldman Apr 05 '18 at 06:26

1 Answers1

1

Both options have their pros and cons. With Paired Namespaces you get the ability to continue sending messages while your primary namespace is down. But don't get fooled. You only store those messages while the primary namespace is down. They are not retried by the reveiver. Other drawbacks include

  • No good testability.
  • Increased cost (you send to the secondary, retrieve back from it to send to the primary).
  • Failover to the secondary is not very intuitive. You have to manually retry the message after a failure. It is not automatically switches to the secondary namespace.

Have a look at this post for more details.

With retries approach you gain the simplicity. And something you'd need to do anyways. With Azure Service Bus operations can fail with intermittent exceptions and you should retry anyways. The drawback of having only retries - doesn't protect from outages. That's why you could combine it with a secondary namespace using custom implementation, but that's a whole different can of warms. Libraries like NServiceBus provides a custom implementation you can get the idea from.

Sean Feldman
  • 23,443
  • 7
  • 55
  • 80
  • @SeanFeldman- as per my understanding in case of service bus paired case, we have not read a message from secondary and push to a primary.once primary available automatically message transferred to from paired service to the primary service bus. ref https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-paired-namespaces – Rukhsar Ahmad Apr 05 '18 at 20:01
  • I couldn't quite follow what you wrote, but looks like you've just repeated my answer :) – Sean Feldman Apr 06 '18 at 04:09
  • I am talking about this point "Increased cost (you send to the secondary, retrieve back from it to send to the primary)." in paired case we are not required to retrieve messages from second and pass to primary one. it is handle automatically by paired service bus. – Rukhsar Ahmad Apr 06 '18 at 11:03
  • You're not receiving messages from the secondary namespace. The *client* does it for you automatically after failover occurred and the primary namespace is online again. – Sean Feldman Apr 06 '18 at 12:55
  • @ SeanFeldman- Now we are talking about the same thing. :-) lets we ignore cost thing. primary service bus created in Region R1 and second service bus in created in Paired region R2. assume primary service has an outage for 5-10 mins. now, what is the best option? Retry or Primary service bus is configured with Paired region service bus? – Rukhsar Ahmad Apr 06 '18 at 15:44
  • There is no "best options". Only "what's good for your scenario / business case" kind of deal. If you only care for sending messages, retrying indefinitely is not a strategy and a Paired Namespace might be better. If you need to send _and_ recieve, Paired namespace won't take you far. – Sean Feldman Apr 06 '18 at 18:56
  • I agree with you. here my intention I don't want to lose any message even primary down for few minutes. thank You @SeanFeldman, to answer my question. nice conversion with you. – Rukhsar Ahmad Apr 06 '18 at 20:51
  • Glad my answer helped. – Sean Feldman Apr 06 '18 at 22:22