在将数据发送给订阅者之前过滤数据 (NServiceBus)

发布于 2024-11-10 04:58:39 字数 435 浏览 4 评论 0原文

我有许多客户需要在新数据添加到我们的数据库表之一时收到通知。 我考虑创建一个服务,每隔 X 秒检查一次表,并通知客户端是否存在任何新数据。问题是,每个客户端都有不同的权限,并不允许查看所有信息。我想过使用像NServiceBus这样的东西来发布带有新信息的消息,但是在发送之前我需要根据每个客户端的权限过滤信息。过滤需要在发送信息之前完成(我不允许在客户端执行过滤)。

NServiceBus 中有对此的内置支持吗?

如果没有,我怎样才能实现这个目标?

编辑: 这是我在下面的评论中写的一个例子: 说我有一个图书馆。每个客户都有兴趣接收有关添加到图书馆的新书的立即通知,但每个客户只能收到有关特定类型的通知。系统应该向所有包含新书信息的客户端发送通知,但每个客户端只应该被通知其特定类型。出于安全原因,我无法过滤客户端中的数据。

谢谢。

I Have many clients which needs to be notified when new data is added 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月寒剑心 2024-11-17 04:58:39

一个可能的选择是只允许某些客户订阅他们可以看到的类型。 NSB 提供 IAuthorizeSubscriptions 接口,允许您确定允许谁订阅消息。通过按类型拆分消息,您可以使用授权界面允许/拒绝订阅这些类型。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文