Open Droni opened 1 month ago
Its up to you to optimize this ... in the stream you can choose to not send a payload.
@michaelstaib Thanks for your reply. The proposed option does not suit us. Ideally, we can make many separate subscriptions, but since the subscription is carried out through the browser, and it has a limit on the number of open subscriptions, this option is not suitable for us. We chose the single subscription path with multiple possible output messages and filtering options. Please look at the example:
[Subscribe]
[UseFiltering]
public CommonEvent<ReadModelEventChangeData>? ReadModelChanged([EventMessage] CommonEvent<ReadModelEventChangeData> ev, IResolverContext context)
=> new[] { ev }.AsQueryable().Filter(context).FirstOrDefault();
Sure, but still implement the stream and you get full control. The subscription has two parts.
@michaelstaib Interesting offer. Is it possible to look at an example somewhere? I found only such an implementation in the documentation.
If you mean the moment of sending, from the example below. Then at this stage we cannot get a filter for a specific subscriber. And perhaps for one subscriber the filter will say that this message is not empty, but for another it will be empty.
var topicName = nameof(Subscriptions.ReadModelChanged);
return topicEventSender.SendAsync(topicName, readModelEvent, cancellationToken);
Product
Hot Chocolate
Is your feature request related to a problem?
When we use a filtered subscription and the response does not match the filter criteria, still an empty message will be sent, but it shouldn't.
The solution you'd like
I expect that if the message is empty, then it shouldn't be sent.