How can I get Azure Service Bus to work in a FIFO manner?
We're not using topics for Azure Service Bus (Which I understand has additional requirements to support ordering, and my understanding was that each queue should revert to operating in a FIFO manner; however, from analysing our logs just for today, we've had 384 of 15442 messages dequeued in a different order to when they were enqueued
To illustrate with an example, we had two messages, d4350a6e68ad4c9fb1fb9ccebd766590 and 0e19fbd29ffd4c4693fff6dd57e4f683; these were enqueued at 2018-11-14 09:27:31.8870000 and 2018-11-14 09:27:35.5950000 respectively (so 0e... was 4ish seconds later than d4...) However, they were dequeued at 2018-11-14 09:30:12.0320000 and 2018-11-14 09:29:57.4850000 respectively (so d4... was 15ish seconds later than 0e...). Over this timescale, we only had a single host active doing both enqueueing and dequeueing.
Whilst the timings on this are relatively close in human terms, we've seen
As I understood the queues to be, well, queues, I'm a little surprised that I'm seeing this behaviour - do I need to do any additional magic to ensure they are dequeued in the order they were enqueued?
For reference, the code that is enqueueing looks a little like:
var brokeredMessage = new BrokeredMessage(objectToQueue, new DataContractJsonSerializer(typeof(T)));
var queueClient = QueueClient.CreateFromConnectionString(connectionString);
queueClient.RetryPolicy = new RetryExponential(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), 5);
queueClient.Send(brokeredMessage);
And we're dequeueing with an Azure Webjob using a service bus trigger
c# azure azureservicebus azure-webjobs
add a comment |
We're not using topics for Azure Service Bus (Which I understand has additional requirements to support ordering, and my understanding was that each queue should revert to operating in a FIFO manner; however, from analysing our logs just for today, we've had 384 of 15442 messages dequeued in a different order to when they were enqueued
To illustrate with an example, we had two messages, d4350a6e68ad4c9fb1fb9ccebd766590 and 0e19fbd29ffd4c4693fff6dd57e4f683; these were enqueued at 2018-11-14 09:27:31.8870000 and 2018-11-14 09:27:35.5950000 respectively (so 0e... was 4ish seconds later than d4...) However, they were dequeued at 2018-11-14 09:30:12.0320000 and 2018-11-14 09:29:57.4850000 respectively (so d4... was 15ish seconds later than 0e...). Over this timescale, we only had a single host active doing both enqueueing and dequeueing.
Whilst the timings on this are relatively close in human terms, we've seen
As I understood the queues to be, well, queues, I'm a little surprised that I'm seeing this behaviour - do I need to do any additional magic to ensure they are dequeued in the order they were enqueued?
For reference, the code that is enqueueing looks a little like:
var brokeredMessage = new BrokeredMessage(objectToQueue, new DataContractJsonSerializer(typeof(T)));
var queueClient = QueueClient.CreateFromConnectionString(connectionString);
queueClient.RetryPolicy = new RetryExponential(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), 5);
queueClient.Send(brokeredMessage);
And we're dequeueing with an Azure Webjob using a service bus trigger
c# azure azureservicebus azure-webjobs
add a comment |
We're not using topics for Azure Service Bus (Which I understand has additional requirements to support ordering, and my understanding was that each queue should revert to operating in a FIFO manner; however, from analysing our logs just for today, we've had 384 of 15442 messages dequeued in a different order to when they were enqueued
To illustrate with an example, we had two messages, d4350a6e68ad4c9fb1fb9ccebd766590 and 0e19fbd29ffd4c4693fff6dd57e4f683; these were enqueued at 2018-11-14 09:27:31.8870000 and 2018-11-14 09:27:35.5950000 respectively (so 0e... was 4ish seconds later than d4...) However, they were dequeued at 2018-11-14 09:30:12.0320000 and 2018-11-14 09:29:57.4850000 respectively (so d4... was 15ish seconds later than 0e...). Over this timescale, we only had a single host active doing both enqueueing and dequeueing.
Whilst the timings on this are relatively close in human terms, we've seen
As I understood the queues to be, well, queues, I'm a little surprised that I'm seeing this behaviour - do I need to do any additional magic to ensure they are dequeued in the order they were enqueued?
For reference, the code that is enqueueing looks a little like:
var brokeredMessage = new BrokeredMessage(objectToQueue, new DataContractJsonSerializer(typeof(T)));
var queueClient = QueueClient.CreateFromConnectionString(connectionString);
queueClient.RetryPolicy = new RetryExponential(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), 5);
queueClient.Send(brokeredMessage);
And we're dequeueing with an Azure Webjob using a service bus trigger
c# azure azureservicebus azure-webjobs
We're not using topics for Azure Service Bus (Which I understand has additional requirements to support ordering, and my understanding was that each queue should revert to operating in a FIFO manner; however, from analysing our logs just for today, we've had 384 of 15442 messages dequeued in a different order to when they were enqueued
To illustrate with an example, we had two messages, d4350a6e68ad4c9fb1fb9ccebd766590 and 0e19fbd29ffd4c4693fff6dd57e4f683; these were enqueued at 2018-11-14 09:27:31.8870000 and 2018-11-14 09:27:35.5950000 respectively (so 0e... was 4ish seconds later than d4...) However, they were dequeued at 2018-11-14 09:30:12.0320000 and 2018-11-14 09:29:57.4850000 respectively (so d4... was 15ish seconds later than 0e...). Over this timescale, we only had a single host active doing both enqueueing and dequeueing.
Whilst the timings on this are relatively close in human terms, we've seen
As I understood the queues to be, well, queues, I'm a little surprised that I'm seeing this behaviour - do I need to do any additional magic to ensure they are dequeued in the order they were enqueued?
For reference, the code that is enqueueing looks a little like:
var brokeredMessage = new BrokeredMessage(objectToQueue, new DataContractJsonSerializer(typeof(T)));
var queueClient = QueueClient.CreateFromConnectionString(connectionString);
queueClient.RetryPolicy = new RetryExponential(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), 5);
queueClient.Send(brokeredMessage);
And we're dequeueing with an Azure Webjob using a service bus trigger
c# azure azureservicebus azure-webjobs
c# azure azureservicebus azure-webjobs
asked Nov 14 '18 at 11:22
Rowland ShawRowland Shaw
32.5k1282147
32.5k1282147
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It is expected behavior. To ensure that the messages are processed in order, you should use Sessions in Service Bus Queues.
This will allow you to process the messages in the sequence in which the messages are en-queued.
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299059%2fhow-can-i-get-azure-service-bus-to-work-in-a-fifo-manner%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It is expected behavior. To ensure that the messages are processed in order, you should use Sessions in Service Bus Queues.
This will allow you to process the messages in the sequence in which the messages are en-queued.
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
add a comment |
It is expected behavior. To ensure that the messages are processed in order, you should use Sessions in Service Bus Queues.
This will allow you to process the messages in the sequence in which the messages are en-queued.
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
add a comment |
It is expected behavior. To ensure that the messages are processed in order, you should use Sessions in Service Bus Queues.
This will allow you to process the messages in the sequence in which the messages are en-queued.
It is expected behavior. To ensure that the messages are processed in order, you should use Sessions in Service Bus Queues.
This will allow you to process the messages in the sequence in which the messages are en-queued.
answered Nov 14 '18 at 11:32
ArunprabhuArunprabhu
929313
929313
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
add a comment |
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
If I'm reading that correctly, that looks like I'll no longer be able to use a service bus trigger on the webjob?
– Rowland Shaw
Nov 14 '18 at 16:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299059%2fhow-can-i-get-azure-service-bus-to-work-in-a-fifo-manner%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown