c# - Windows服务总线接收函数64位int

标签 c# azure servicebus azureservicebus

嘿,

我想在 C# 中使用 ReceiveBatch-Methode (IEnumerable(Int64))。它需要一个 IEnumerable(Int64 -> long)。我需要这个函数,因为在 GetMessageNumber(topicName, subscriptionName) 函数中,我使用服务总线中的实习计数器,它返回一个长值。另一个接收函数仅提供一个 int。我尝试了这个函数,但总是收到 MessageNotFoundException was unhadeld by user code。

Failed to lock at least a specified message. The message is not vorhanden..TrackingId:a2e6b0f0-fd3d-4594-935d-936ff7b3210c_GLBHPC0474_BLBHPC0474,TimeStamp:28.03.2014 13:41:57

http://msdn.microsoft.com/de-de/library/jj657801.aspx

        IEnumerable<long> messageNumber = new long[]
        {
            GetMessageNumber(topicName, subscriptionName)
        };

        IEnumerable<BrokeredMessage> messages = null;

            try
            {
                //Receives a message using the InternalReceiver.
                messages = subscriptionClient.ReceiveBatch(messageNumber);

但是我用 int 函数 ReceiveBatch-Methode (Int32) 尝试了一下,它成功了。问题是我需要具有 long 值的函数,为什么他们使用 IEnumerable 来使用具有 64 位值的接收函数?我怎样才能使用正确的 64 位值的函数?

        IEnumerable<BrokeredMessage> messages = null;

        long messageNumber = GetMessageNumber(topicName, subscriptionName);

            try
            {
                //Receives a message using the InternalReceiver.
                messages = subscriptionClient.ReceiveBatch(messageNumber);

致以诚挚的问候

最佳答案

ReceiveBatch(maxMessageCount) API 用于获取下一批消息,其中返回的消息数量限制为 maxMessageCount 值。当您使用“MessageNumber”时,您是否以某种方式暗示了消息的 ID?这不是 ReceveBatch 的目的。如果您可以澄清该场景,那么我们可以提供更多指导。

关于c# - Windows服务总线接收函数64位int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22714786/

相关文章:

c# - 从 ARM 模板部署新的 Azure VM 时,无法格式化 .WithParameters() 的有效 JObject

azure - Microsoft Azure AD Connect 配置代理错误 5

Windows Phone 上的 Azure Servicebus 中继

适用于 Windows Server 的 ServiceBus 上的 Java - 选项?

c# - 针对两个不同的程序集引用编译相同的代码?

c# - IEnumerable<T> 等于 ICollection<T> 类型检查

asp.net-mvc - 应用服务及其相应的 Web API 是否应该使用相同的 Application Insights?

azure - 直接向订阅发送消息

c# - 基类实现 INotifyPropertyChanged : can derived types use its PropertyChanged event?

c# - 模式匹配路径+文件(UNC?)