简体   繁体   English

服务总线2.6.6配对命名空间启用Siphon

[英]Service Bus 2.6.6 Paired Namespace Enable Syphon

How to make work Paired Namespace receiver side to move messages from backlog queue to the primary queue. 如何使工作成对命名空间接收方将邮件从积压队列移动到主队列。 It seems to work with senders but with the receivers setting EnableSyphon = true does not seems to work. 它似乎适用于发送方,但是使用接收方设置EnableSyphon = true似乎不起作用。 I can see always messages in the backlog queue and growing. 我总是可以看到积压队列中的消息不断增长。 All information that I could found is this Code Block , but since Service Bus 2.4 Messaging.Factory does not have a Open Method. 我可以找到的所有信息都是此Code Block,但是由于Service Bus 2.4 Messaging.Factory没有开放方法。

factory = MessagingFactory.Create(SB_Primary_NS_Address);
factory.PairNamespace(new SendAvailabilityPairedNamespaceOptions
{
    EnableSyphon = true,
    TransferQueueCount = 10,
    MessagingFactory = paired-NS_factory,
    NamespaceManager = paired-NS_manager
});
factory.Open();

They have changed how the to Pair a Namespace with the more so recent versions. 他们更改了将命名空间与最新版本配对的方式。 Instead you call an Async function (PairNamespaceAsync) from the primary messaging factory by passing in a PairedNamespaceOptions instance. 相反,您可以通过传入PairedNamespaceOptions实例从主消息传递工厂调用Async函数(PairNamespaceAsync)。 Note that the Task returned is actually a Promise type, so you do not call Start() on the Task, because it was already started, simply call Waiting(). 请注意,返回的Task实际上是Promise类型的,因此您不必在Task上调用Start(),因为它已经启动,只需调用Waiting()。

Also, you have to make sure that the Secondary Namespace and MessagingFactory have Management level security. 此外,还必须确保辅助命名空间和MessagingFactory具有管理级别的安全性。 Simply having a Publish will not suffice for the MessagingFactory, it will not send back the messages to the Primary Queue/Topic. 仅仅拥有一个发布就不能满足MessagingFactory的要求,它也不会将消息发送回主队列/主题。

// assume members _messagingFactory, _secondaryNamespaceManager, _secondaryManagementMessagingFactory have been assigned.

try
{
    var pairedNamespaceOptions = new SendAvailabilityPairedNamespaceOptions(_secondaryNamespaceManager,
            _secondaryManagementMessagingFactory,
            1,
            TimeSpan.FromSeconds(30),
            true);
    _messagingFactory.PairNamespaceAsync(pairedNamespaceOptions).Wait();
}
catch (Exception ex)
{
    // logging or handle
}

Some helpful links. 一些有用的链接。

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

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