简体   繁体   English

将过滤的消息保留在Azure Service Bus主题订阅中

[英]Keeping filtered messages in azure service bus topic subscriptions

I have a topic with a single subscription in it. 我有一个主题,里面有一个订阅。 The subscription has a filter that filters a set of UserProperties. 订阅具有一个过滤器,该过滤器过滤一组UserProperty。 Filtering works fine. 过滤效果很好。

The problem is, if a message is checked against the filters of the subscription and it fails to match the rules the message gets deleted. 问题是,如果根据订阅的筛选器检查了一条消息,但该消息与规则不匹配,则会删除该消息。 Is there a way to keep the messages in the subscription and not have them removed? 有没有一种方法可以将消息保留在订阅中而不删除它们?

The reason I want this is we have our services configure the rules for subscription when deployed, and a service with a message broker that is sending a new set of messages might get deployed before the service with the subscription client changing the rule set and new business logic. 我想要这个的原因是我们让我们的服务在部署时配置了订阅规则,并且在发送带有新消息集的消息代理的服务可能会在带有订阅客户端的服务更改规则集和新业务的服务之前被部署逻辑。 We do not want to lose the messages sent during deployment and process them when the new service is out. 我们不想丢失在部署期间发送的消息并在新服务退出时对其进行处理。

Cheers. 干杯。

As the others have mentioned, this is by design and for your requirement, you have these options 正如其他人所提到的,这是设计使然,根据您的要求,您可以选择以下选项

  • Create subscriptions before hand which will persist the filtered messages and your subscriber service could fetch them from the subscription when it comes up. 事先创建订阅,该订阅将保留已过滤的消息,并且订阅者服务可以在订阅出现时从订阅中获取它们。

  • Use Message Sessions on a queue instead with one session per subscriber. 在队列上使用消息会话 ,而不是每个订阅者一个会话。 The requirement here though would be to have your initial deployment send messages with a unique SessionId set on these messages (which should essentially be based on the filters you have later now) instead of using filters later 不过,这里的要求是让您的初始部署发送在这些消息上设置了唯一SessionId消息(这基本上应基于您现在拥有的过滤器),而不是稍后使用过滤器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM