简体   繁体   中英

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. 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.

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. 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().

Also, you have to make sure that the Secondary Namespace and MessagingFactory have Management level security. Simply having a Publish will not suffice for the MessagingFactory, it will not send back the messages to the Primary Queue/Topic.

// 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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