question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cancelling subscriptions does not consume the message

See original GitHub issue

(Queue names fixed based on @micdenny comments)

Maybe I am doing something wrong.

My system works with prefetchcount=1 and I have multiple asynchronous subscriptions for different topics, for example:

var subscription1 = bus.SubscribeAsync(queueName1, OnMessage1, cfg => cfg.WithTopic("topic1"));
var subscription2 = bus.SubscribeAsync(queueName2, OnMessage2, cfg => cfg.WithTopic("topic2"));
var subscription3 = bus.SubscribeAsync(queueName3, OnMessage3, cfg => cfg.WithTopic("topic3"));

then while a message is being processing, I cancel a subscription, for example:

subscription1.ConsumerCancellation.Dispose();

The thread that was processing the subscription finished correctly, so the message has been processed, but if I start a new subscription for that topic, the message is processed again:

var anotherSubscription = bus.SubscribeAsync(queueName1, OnMessage1, cfg => cfg.WithTopic("topic1"));

Do you have an idea about how can I fix it to avoid process the same message twice?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
zidadcommented, Nov 2, 2016

I agree! however in case of a ‘controlled’ cancellation it should be possible to have the option to finish/ACK the messages that have been picked up.

1reaction
andresmoschinicommented, Oct 28, 2016

Thanks @micdenny!

Very detailed and useful answer, I will read the links and try to adapt my consumer to be idempotent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If you want to cancel a subscription from Apple
Open the Settings app. Tap your name. Tap Subscriptions. The Subscriptions button in Settings on iPhone. Tap the subscription. Tap Cancel ...
Read more >
Cancel, pause, or change a subscription on Google Play
Important: When you uninstall the app, your subscription won't cancel. On your Android device, go to your subscriptions in Google Play. Select the...
Read more >
Unable to cancel subscription
When I have tried to cancel my subscription (zoom one) I got the message "You should firstly cancel all additional subscriptions." Then I...
Read more >
Cancel subscriptions
Subscriptions are canceled automatically after up to four unsuccessful attempts to bill the customer. You can configure this in your subscription lifecycle ...
Read more >
Consumers
In this sense a consumer is a subscription for message delivery that has to be registered before deliveries begin and can be cancelled...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found