Closed tomkerkhove closed 3 years ago
Would this filter mean that you could filter on the typed CloudEvent/EventGridEvent payloads? Or only the event itself. Maybe some context here could be helpful, where you could encountered the opportunity.
Now you can do the following:
var rawReceivedEvent = _eventConsumerHost.GetReceivedEvent(eventId, timeout.Value);
But instead, I'd like to filter on one of the following things:
So giving us a func that gives us the CloudEvent
and allows us to return true
or false
.
var rawReceivedEvent = _eventConsumerHost.GetReceivedEvent(cloudEvent => cloudEvent.Subject.Contains("my-id"), timeout.Value);
But next to that I'd like to be able to have a func which gives me the deserialized data payload on which I can work.
var rawReceivedEvent = _eventConsumerHost.GetReceivedEvent<OrderCreatedEvent>(orderCreatedEvent => orderCreatedEvent.OrderId == ("my-order-id"), timeout.Value);
Ok, that we can do! Maybe, in this case, you also want to get a set of events, as the filter could not always be referencing to a unique event?
For us it is aimed for single events at the moment, but who knows 🤷♂️
For us it is aimed for single events at the moment, but who knows 🤷♂️
Aha, ok, bc you may get false positives when receiving on something that's available for multiple events.
That's certainly possible, but with great filtering power comes great responsibilities :D
What feature would you like to have? Provide support to filter based on event payload for writing automated tests instead of relying on the event ID.