简体   繁体   中英

Windows Service Bus receive function 64bit int

Hy,

I want to use the ReceiveBatch-Methode (IEnumerable(Int64)) in C#. It needs a IEnumerable(Int64 -> long). I need this function because in the GetMessageNumber(topicName, subscriptionName) function I use the intern counter from the service Bus wihich returns a long value. The other receive function only offer a int. I tried this function but I always get an 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);

But the I tried it with the int function ReceiveBatch-Methode (Int32) and it worked. The problem is that I need the function with the long value and why they use an IEnumerable to use the receive function with the 64 bit value? How I can accomplish to use the function with the 64 bit value correct?

        IEnumerable<BrokeredMessage> messages = null;

        long messageNumber = GetMessageNumber(topicName, subscriptionName);

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

Best regards

ReceiveBatch(maxMessageCount) API is for getting the next batch of messages where the number of messages returned is limited up to the maxMessageCount value. When you use "MessageNumber" are you in some way implying an ID to a message? That is not what ReceveBatch is meant to do. If you can clarify the scenario then we could provide more guidance.

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