Why blacklisting of event types instead of proactively determining the event types needed by the client?

On GitHub Allard Buijze kindly provided this information:

[…] event filtering does happen on the server side, but not proactively. Essentially, AxonServer will always transmit all events to the client. As the client receives message types that it will c ertainly never process, it will blacklist them. This list is shared on the connection, across to AxonServer. As long as that connection is alive, then the message will not be transmitted again. If the connection is re-established, for some reason, the blacklist on the server side will need to be rebuilt (which will eventually happen).

Why is it not possible to detect the needed event types on the client-side proactively?
Would it not be possible to find on the client-side all event handlers and possibly other Axon constructs, which may need events, and then to only subscribe to these event types?

Thanks in advance!

Nobody there, who can help?


the short answer is “no, it’s not feasible”. The main reason is that the client may have upcasters. Upcasters potentially change one type of event into another. With a whitelisting, you’d have to reason backwards and find all potential event types that you could upcast into the ones you do know.

That means whitelisting will have significant complexity, and I seriously doubt the performance benefit that you will get. Blacklisting is a lot safer and simpler to implement.



this makes sense, thanks!