Azure WebJob sudden shutdown while processing












0















I have a continuous Azure WebJob, that is set to 'Always On'.
This WebJob is supposed to handle new messages being added to a storage queue.



I'm wondering what if for some reason the WebJob has stopped working while it was processing a queue trigger. This way I will lose the message from the queue, and it won't go to poison queue.



How can I workaround this?










share|improve this question


















  • 1





    Did you check the logs? Maybe an unhandled exception occured?

    – Peter Bons
    Nov 25 '18 at 16:11






  • 1





    What's the WebJob status in the Kudu?And did the WebJob work properly at first?Please give more details and i will help you.

    – George Chen
    Nov 26 '18 at 1:53











  • Regarding exceptions, I know and already verified that messages caused exceptions while processing will be moved to the Poison queue.

    – Akram Qalalwa
    Nov 26 '18 at 8:05











  • What I'm targeting in my question, is that what if I turned off the host App Service while the WebJob was processing a queue message. What will happen to the message then? I'm sure that it won't be moved to the Poison queue, and verified this. But now I can't find my message neither in the original queue, nor in the poison. And it didn't even be processed to the end of my flow due to the job shutdown. Is there anyway I can be notified that my job is shutting down so for example I can return back my message to its' original queue?

    – Akram Qalalwa
    Nov 26 '18 at 8:06


















0















I have a continuous Azure WebJob, that is set to 'Always On'.
This WebJob is supposed to handle new messages being added to a storage queue.



I'm wondering what if for some reason the WebJob has stopped working while it was processing a queue trigger. This way I will lose the message from the queue, and it won't go to poison queue.



How can I workaround this?










share|improve this question


















  • 1





    Did you check the logs? Maybe an unhandled exception occured?

    – Peter Bons
    Nov 25 '18 at 16:11






  • 1





    What's the WebJob status in the Kudu?And did the WebJob work properly at first?Please give more details and i will help you.

    – George Chen
    Nov 26 '18 at 1:53











  • Regarding exceptions, I know and already verified that messages caused exceptions while processing will be moved to the Poison queue.

    – Akram Qalalwa
    Nov 26 '18 at 8:05











  • What I'm targeting in my question, is that what if I turned off the host App Service while the WebJob was processing a queue message. What will happen to the message then? I'm sure that it won't be moved to the Poison queue, and verified this. But now I can't find my message neither in the original queue, nor in the poison. And it didn't even be processed to the end of my flow due to the job shutdown. Is there anyway I can be notified that my job is shutting down so for example I can return back my message to its' original queue?

    – Akram Qalalwa
    Nov 26 '18 at 8:06
















0












0








0








I have a continuous Azure WebJob, that is set to 'Always On'.
This WebJob is supposed to handle new messages being added to a storage queue.



I'm wondering what if for some reason the WebJob has stopped working while it was processing a queue trigger. This way I will lose the message from the queue, and it won't go to poison queue.



How can I workaround this?










share|improve this question














I have a continuous Azure WebJob, that is set to 'Always On'.
This WebJob is supposed to handle new messages being added to a storage queue.



I'm wondering what if for some reason the WebJob has stopped working while it was processing a queue trigger. This way I will lose the message from the queue, and it won't go to poison queue.



How can I workaround this?







azure azure-webjobs azure-webjobssdk alwayson azure-webjobs-continuous






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 '18 at 15:04









Akram QalalwaAkram Qalalwa

1159




1159








  • 1





    Did you check the logs? Maybe an unhandled exception occured?

    – Peter Bons
    Nov 25 '18 at 16:11






  • 1





    What's the WebJob status in the Kudu?And did the WebJob work properly at first?Please give more details and i will help you.

    – George Chen
    Nov 26 '18 at 1:53











  • Regarding exceptions, I know and already verified that messages caused exceptions while processing will be moved to the Poison queue.

    – Akram Qalalwa
    Nov 26 '18 at 8:05











  • What I'm targeting in my question, is that what if I turned off the host App Service while the WebJob was processing a queue message. What will happen to the message then? I'm sure that it won't be moved to the Poison queue, and verified this. But now I can't find my message neither in the original queue, nor in the poison. And it didn't even be processed to the end of my flow due to the job shutdown. Is there anyway I can be notified that my job is shutting down so for example I can return back my message to its' original queue?

    – Akram Qalalwa
    Nov 26 '18 at 8:06
















  • 1





    Did you check the logs? Maybe an unhandled exception occured?

    – Peter Bons
    Nov 25 '18 at 16:11






  • 1





    What's the WebJob status in the Kudu?And did the WebJob work properly at first?Please give more details and i will help you.

    – George Chen
    Nov 26 '18 at 1:53











  • Regarding exceptions, I know and already verified that messages caused exceptions while processing will be moved to the Poison queue.

    – Akram Qalalwa
    Nov 26 '18 at 8:05











  • What I'm targeting in my question, is that what if I turned off the host App Service while the WebJob was processing a queue message. What will happen to the message then? I'm sure that it won't be moved to the Poison queue, and verified this. But now I can't find my message neither in the original queue, nor in the poison. And it didn't even be processed to the end of my flow due to the job shutdown. Is there anyway I can be notified that my job is shutting down so for example I can return back my message to its' original queue?

    – Akram Qalalwa
    Nov 26 '18 at 8:06










1




1





Did you check the logs? Maybe an unhandled exception occured?

– Peter Bons
Nov 25 '18 at 16:11





Did you check the logs? Maybe an unhandled exception occured?

– Peter Bons
Nov 25 '18 at 16:11




1




1





What's the WebJob status in the Kudu?And did the WebJob work properly at first?Please give more details and i will help you.

– George Chen
Nov 26 '18 at 1:53





What's the WebJob status in the Kudu?And did the WebJob work properly at first?Please give more details and i will help you.

– George Chen
Nov 26 '18 at 1:53













Regarding exceptions, I know and already verified that messages caused exceptions while processing will be moved to the Poison queue.

– Akram Qalalwa
Nov 26 '18 at 8:05





Regarding exceptions, I know and already verified that messages caused exceptions while processing will be moved to the Poison queue.

– Akram Qalalwa
Nov 26 '18 at 8:05













What I'm targeting in my question, is that what if I turned off the host App Service while the WebJob was processing a queue message. What will happen to the message then? I'm sure that it won't be moved to the Poison queue, and verified this. But now I can't find my message neither in the original queue, nor in the poison. And it didn't even be processed to the end of my flow due to the job shutdown. Is there anyway I can be notified that my job is shutting down so for example I can return back my message to its' original queue?

– Akram Qalalwa
Nov 26 '18 at 8:06







What I'm targeting in my question, is that what if I turned off the host App Service while the WebJob was processing a queue message. What will happen to the message then? I'm sure that it won't be moved to the Poison queue, and verified this. But now I can't find my message neither in the original queue, nor in the poison. And it didn't even be processed to the end of my flow due to the job shutdown. Is there anyway I can be notified that my job is shutting down so for example I can return back my message to its' original queue?

– Akram Qalalwa
Nov 26 '18 at 8:06














1 Answer
1






active

oldest

votes


















1















I'm wondering what if for some reason the WebJob has stopped working
while it was processing a queue trigger.




Firstly, if the WebJob would exit while process message, you don't have to worry about corrupted data. When the WebJob access the message to process, it will hide the message in the queue for a certain amount time. If your WebJob shut down while process the message, the message will be available again after the time, and it will be re-grabbed and ran against the updated code.About the details, you could refer to this answer.



As for your requirement about being notified the job is shutting down. You could use Graceful Shutdown and listen to CancellationToken you can pass to you triggered function and judge the property IsCancellationRequired value , then you could handle the WebJob would shut down. Here is the sample code about CancellationToken.






share|improve this answer
























  • You're extremely awesome man!!

    – Akram Qalalwa
    Nov 27 '18 at 13:38













  • Is there someway to control the leasing time span?

    – Akram Qalalwa
    Nov 27 '18 at 13:40











  • Sorry, i don't think it could be controlled.

    – George Chen
    Nov 28 '18 at 1:06











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468804%2fazure-webjob-sudden-shutdown-while-processing%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









1















I'm wondering what if for some reason the WebJob has stopped working
while it was processing a queue trigger.




Firstly, if the WebJob would exit while process message, you don't have to worry about corrupted data. When the WebJob access the message to process, it will hide the message in the queue for a certain amount time. If your WebJob shut down while process the message, the message will be available again after the time, and it will be re-grabbed and ran against the updated code.About the details, you could refer to this answer.



As for your requirement about being notified the job is shutting down. You could use Graceful Shutdown and listen to CancellationToken you can pass to you triggered function and judge the property IsCancellationRequired value , then you could handle the WebJob would shut down. Here is the sample code about CancellationToken.






share|improve this answer
























  • You're extremely awesome man!!

    – Akram Qalalwa
    Nov 27 '18 at 13:38













  • Is there someway to control the leasing time span?

    – Akram Qalalwa
    Nov 27 '18 at 13:40











  • Sorry, i don't think it could be controlled.

    – George Chen
    Nov 28 '18 at 1:06
















1















I'm wondering what if for some reason the WebJob has stopped working
while it was processing a queue trigger.




Firstly, if the WebJob would exit while process message, you don't have to worry about corrupted data. When the WebJob access the message to process, it will hide the message in the queue for a certain amount time. If your WebJob shut down while process the message, the message will be available again after the time, and it will be re-grabbed and ran against the updated code.About the details, you could refer to this answer.



As for your requirement about being notified the job is shutting down. You could use Graceful Shutdown and listen to CancellationToken you can pass to you triggered function and judge the property IsCancellationRequired value , then you could handle the WebJob would shut down. Here is the sample code about CancellationToken.






share|improve this answer
























  • You're extremely awesome man!!

    – Akram Qalalwa
    Nov 27 '18 at 13:38













  • Is there someway to control the leasing time span?

    – Akram Qalalwa
    Nov 27 '18 at 13:40











  • Sorry, i don't think it could be controlled.

    – George Chen
    Nov 28 '18 at 1:06














1












1








1








I'm wondering what if for some reason the WebJob has stopped working
while it was processing a queue trigger.




Firstly, if the WebJob would exit while process message, you don't have to worry about corrupted data. When the WebJob access the message to process, it will hide the message in the queue for a certain amount time. If your WebJob shut down while process the message, the message will be available again after the time, and it will be re-grabbed and ran against the updated code.About the details, you could refer to this answer.



As for your requirement about being notified the job is shutting down. You could use Graceful Shutdown and listen to CancellationToken you can pass to you triggered function and judge the property IsCancellationRequired value , then you could handle the WebJob would shut down. Here is the sample code about CancellationToken.






share|improve this answer














I'm wondering what if for some reason the WebJob has stopped working
while it was processing a queue trigger.




Firstly, if the WebJob would exit while process message, you don't have to worry about corrupted data. When the WebJob access the message to process, it will hide the message in the queue for a certain amount time. If your WebJob shut down while process the message, the message will be available again after the time, and it will be re-grabbed and ran against the updated code.About the details, you could refer to this answer.



As for your requirement about being notified the job is shutting down. You could use Graceful Shutdown and listen to CancellationToken you can pass to you triggered function and judge the property IsCancellationRequired value , then you could handle the WebJob would shut down. Here is the sample code about CancellationToken.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 27 '18 at 6:38









George ChenGeorge Chen

1,302119




1,302119













  • You're extremely awesome man!!

    – Akram Qalalwa
    Nov 27 '18 at 13:38













  • Is there someway to control the leasing time span?

    – Akram Qalalwa
    Nov 27 '18 at 13:40











  • Sorry, i don't think it could be controlled.

    – George Chen
    Nov 28 '18 at 1:06



















  • You're extremely awesome man!!

    – Akram Qalalwa
    Nov 27 '18 at 13:38













  • Is there someway to control the leasing time span?

    – Akram Qalalwa
    Nov 27 '18 at 13:40











  • Sorry, i don't think it could be controlled.

    – George Chen
    Nov 28 '18 at 1:06

















You're extremely awesome man!!

– Akram Qalalwa
Nov 27 '18 at 13:38







You're extremely awesome man!!

– Akram Qalalwa
Nov 27 '18 at 13:38















Is there someway to control the leasing time span?

– Akram Qalalwa
Nov 27 '18 at 13:40





Is there someway to control the leasing time span?

– Akram Qalalwa
Nov 27 '18 at 13:40













Sorry, i don't think it could be controlled.

– George Chen
Nov 28 '18 at 1:06





Sorry, i don't think it could be controlled.

– George Chen
Nov 28 '18 at 1:06




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468804%2fazure-webjob-sudden-shutdown-while-processing%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen