简体   繁体   English

死信队列中的服务总线克隆不起作用

[英]Service Bus Clone from Dead Letter Queue Not Working

I am trying to take a single message from a service bus dead letter queue, clone it and send it back to the original queue.我试图从服务总线死信队列中获取一条消息,克隆它并将其发送回原始队列。 I am using the clone method, then removing dead letter reasons from the userproperties before using SendAsync to send it back.我正在使用克隆方法,然后在使用 SendAsync 将其发回之前从用户属性中删除死信原因。

Two issues I've noticed -- as I remove properties from the new, cloned message, those properties are also being removed from the original message.我注意到的两个问题——当我从新的、克隆的消息中删除属性时,这些属性也从原始消息中删除。 Also, when I use the SendAsync method, I never see the new message anywhere.此外,当我使用 SendAsync 方法时,我从未在任何地方看到新消息。

Any help would be appreciated.任何帮助,将不胜感激。

            string fullPath = EntityNameHelper.FormatSubscriptionPath(TopicName, subscriptionName);
            var deadLetterClient = new MessageReceiver(ServiceBusConnectionString, fullDeadLetterPath);
            var client = new MessageSender(ServiceBusConnectionString, fullPath);

            var messages = deadLetterClient.ReceiveAsync(1).Result;
            if (messages.Any())
            {
                var message = messages.First();
                var newMessage = message.Clone();
                newMessage.UserProperties.Remove("DeadLetterReason");
                newMessage.UserProperties.Remove("DeadLetterErrorDescription");

                client.SendAsync(newMessage);
            }

newMessage.UserProperties == message.UserProperties yields true. newMessage.UserProperties == message.UserProperties 产生真。 Apparently there is some type of bug with the clone method where it is not doing a deep clone.显然, clone 方法存在某种类型的错误,它没有进行深度克隆。

My best guess at this point is I am going to have to manually create a new copy of the message object rather than rely on the clone operation.在这一点上,我最好的猜测是我将不得不手动创建消息对象的新副本,而不是依赖于克隆操作。

暂无
暂无

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

相关问题 Azure 服务总线 | 重新处理死信消息返回队列 | 如何接收来自死信队列的所有消息? - Azure service bus | Re process dead letter messages back to queue | How to receive all messages from dead letter queue? 我们可以使用 .net 代码从 Azure 服务总线中的死信队列中删除基于序列号的特定死信消息吗? - can we delete a specific dead letter message based on the sequence number from dead letter queue in Azure service bus using .net code? 通过MessageId在Azure Service Bus死信队列上获取消息 - Getting a Message by MessageId on the Azure Service Bus Dead Letter queue brokeredmessage微软服务总线队列ReceiveBatch无法获取所有死信消息 - brokeredmessage microsoft service bus queue ReceiveBatch not obtaining all dead letter messages 使用存储队列和服务总线时,Azure 死信队列和毒药队列有什么区别? - What is the difference between Azure Dead Letter Queues and Poison Queues when using Storage Queue and Service Bus? 阅读服务总线主题订阅死信队列 (DLQ) C# 的最佳方式 - Best way to read Service Bus Topic Subscription Dead Letter Queue (DLQ) C# 如何在 Azure 服务总线中显式向主题订阅死信队列发送消息 - How to send message to Topic Subscription Dead Letter Queue Explicitly in Azure Service Bus Azure Service Bus中死信队列中的邮件是否过期? - Do messages in dead letter queues in Azure Service Bus expire? 服务总线一个订户,多个死信主题订户 - Service bus one subscriber for multiple dead-letter topic subscribers 如何删除Azure Service Bus队列中的死信? - How do you delete the dead letters in an Azure Service Bus queue?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM