SubscriptionClient deadletterSubscriptionClient = messagingFactory.CreateSubscriptionClient( Create a subscription client to the deadletter queue Var dlQueueName = SubscriptionClient.FormatDeadLetterPath(subscriptionClient.TopicPath, Get the Dead Letter queue path for this subscription MessagesSubscription.Name, ReceiveMode.PeekLock) SubscriptionClient subscriptionClient = ( MessagesSubscription = namespaceManager.GetSubscription(topic.Path, If (!namespaceManager.SubscriptionExists(topic.Path, ssagingFactory = MessagingFactory.Create(namespaceAddress, TokenProvider.CreateSharedSecretTokenProvider(issuerName, issuerKey)) This.namespaceManager = new NamespaceManager(namespaceAddress, Uri namespaceAddress = ServiceBusEnvironment.CreateServiceUri( "sb", baseAddress, string.Empty) Here is an example of retrieving a dead lettered message from a subscription queue var baseAddress = The DeadLetter can be deleted in the same was as a normal message by calling the Complete() method on the received dead letter message The DeadLetter method allows you to pass in your own data to explain why the message has failed. You can also move the message yourself and put in sensible data in the properties if it fails to be processed by calling the DeadLetter method on the BrokeredMessage. By default the subscription will move a faulty message to the dead letter queue after 10 attempts to deliver. The message should also contain the message body from the original message. Once a deadletter brokered message is received the properties of the message should contain error information highlighting why it has failed. Once you have this address you can connect to the dead letter queue in the same way you would connect to the subscription queue. To create a subscription to the deadletter queue you need to append /$DeadLetterQueue to the subscription name when you create the subscription client SubscriptionClient.FormatDeadLetterPath(subscriptionClient.TopicPath, messagesSubscription.Name) Luckily you don’t have to remember this as there are helpful methods to retrieve the address for you: YourTopic/Subscriptions/YourSubscription/ $DeadLetterQueue The address of the deadletter queue is slightly different from your subscription queue and is the form: The deadletter queue is a separate queue that allows messages that fail to be processed to be stored and analysed. On closer inspection we found that our subscription queue was empty and the numbers in the management portal against the subscription were messages that had automatically faulted and had been moved into the Dead Letter queue. Whilst working on a project in which we we using the Topics on Windows Azure Service Bus, we noticed that our subscription queues (when viewed from the Windows Azure Management portal) didn’t seem to be empty even though our subscription queue processing code was working correctly. August 2013 steve Service Bus, Windows Azure (0)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |