I have a system that publishes events to a message broker, lets call that system A. I also have system B and system C that subscribes to the "events"/messages.
My payload/message looks like the following:
{
"eventType":"EntityCreated",
"entityId": 123,
"properties": {
"somedata1": "somevalue1",
"somedata2": "somevalue2"
}
}
(This is not how the message really looks.. its just for giving some context to my problem)
Now.. system B is allowed to subscribe and view all events and properties. While system C is not allowed to view any properties given that entityId is NOT 123.
How would this be solved? Im thinking that I might be able to use event sourcing and some sort of auth-mechanic so instead of sending the actual properties over the message, the systems would have to query an api to get an "eventId".. and then that could validate if the system is authorized or not to view the event. But is there any more common pattern/way of doing this? One big drawback with my suggestion would be that if I have many consumers/subscribers, I might end up having a heavy load on that "event sourcing API".