开发者

Filter data before sending it to a subscriber (NServiceBus)

开发者 https://www.devze.com 2023-03-08 21:27 出处:网络
I Have many clients which needs to be notified when new data is adde开发者_开发百科d to one of our DB tables.

I Have many clients which needs to be notified when new data is adde开发者_开发百科d to one of our DB tables. I Think about creating a service which checks the table every X seconds and notifies the clients if any new data exists. The problem is, each client have different permissions and is not allowed to see all the information. I thought about using something like NServiceBus to publish the message with the new information, but I need to filter the information according to each client's permissions before sending it. The filtering needs to be done before sending the info (I'm not allowed to perform the filtering on the client side).

Is there a built-in support for this in NServiceBus?

If not, How can I achieve this goal?

EDIT: Here is an example I wrote in the comment below: say I have a book library. Each client is interested in receiving immediate notification about new books added to the library, but each client is allowed to be notified only about a certain genre. The system should send a notification to all the clients containing the new books information, but each client should only be notified about his specific genre. For security reasons, I can't filter the data in the client.

Thanks.


A potential option would be to only allow certain clients to subscribe to genres they are allowed to see. NSB provides the IAuthorizeSubscriptions interface to allow you to determine who is allowed to subscribe to a message. By splitting up the messages by genre you could then allow/deny subscription to those genres by using the authorization interface.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号