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.

[Service Bus] Rework MessageLockCancellationToken/SessionLockCancellationToken to use events

See original GitHub issue

After reviewing the proposed API with the architects, we received feedback that it would be more idiomatic to have a pattern like the following:

async Task ProcessMessage(ProcessMessageEventArgs args)
{
    using var cts = CancellationTokenSource.CreateLinkedTokenSource(args.CancellationToken);
    args.MessageLockLostAsync += cts.Cancel();

    await FooAsync(args.Message, cts.Token);
}

This means we would need to replace the MessageLockCancellationToken/SessionLockCancellationToken properties with events that can be subscribed to.

/cc @danielmarbach

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
danielmarbachcommented, Jul 16, 2023

I can throw up a PR to make the API change (unless you would prefer to do this) - you already did all of the heavy lifting - I can just trigger the event when the token is signaled by using a registration.

Thanks. I’m currently on vacation and taking a bit of a break from coding. I’m back in two weeks and could pick it up if it hasn’t been done until then but I guess you want to fix this asap

0reactions
JoshLove-msftcommented, Jul 16, 2023

Another benefit of the event-based approach is that we can subclass EventArgs to allow us to flow through context data to the event. It is probably interesting to include the exception, and possibly the LockedUntilTime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Service Bus queues and topics as event handlers for Azure ...
Describes how you can use Service Bus queues and topics as event handlers for Azure Event Grid events.
Read more >
Azure Service Bus to Event Grid integration overview
This article provides a description of how Azure Service Bus messaging integrates with Azure Event Grid.
Read more >
One topic per event producer VS One topic shared across ...
UPDATE 1: I don't know NServiceBus, but I've worked a bit with MassTransit and when leveraging the topology creation to MassTransit (which is ......
Read more >
Posting Microsoft Dataverse Events to Azure Service Bus
There will be situations where you may need to export core, transactional information from Microsoft Dataverse into an external system.
Read more >
How to Chose | Azure Service Bus vs Event Hub vs ... - YouTube
We also compare Azure Service Bus, Azure Event Grid, and Azure Event Hub to ... Azure Event Hub 3️⃣ Exploration of their real-time...
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