pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
747 stars 144 forks source link

Make BasicDeliverEventArgs available for subscriptions #307

Closed fgieseke closed 6 years ago

fgieseke commented 6 years ago

Is there a possibility to access the BasicDeliverEventArgs when receiving a message a consumer subscribed on? I need to read the routing key the message was send with. Also the headers have to be accessible, to build up some custom business-logic. Is there already such a feature? I couldn't find it...

pardahlman commented 6 years ago

If you're using the message context enrichers you should be able to do something like this to get hold of the delivery args.

pardahlman commented 6 years ago

If you have business logic that you want to extract in a structured way, then perhaps a custom message context could be used - here is an example where a context is built up from properties in the pipe context - basic event args are there, too.

fgieseke commented 6 years ago

Thanks for the examples. We're still on version 1.10.4, so the examples don't fit. But our solution is to extend the AdvancedMessageContext adding property "EventArgs". Our custom ContextEnhancer then sets in WireUpContextFeatures the EventArgs to the BasicDeliverEventArgs provided.

Wouldn't this be a feature for the build in AdvancedMessageContext?

pardahlman commented 6 years ago

I think that sounds like a good approach ๐Ÿ‘Œ .

fgieseke commented 6 years ago

It worked. We will be switching from version 1.x to 2.x. Is there a good introduction to the changes? Any hint would be apreciated.

Thanks so far.

Falko

On Tue, Feb 6, 2018 at 7:48 PM +0100, "Pรคr Dahlman" notifications@github.com wrote:

I think that sounds like a good approach ๐Ÿ‘Œ .

โ€” You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.