Azure Function and queueHow to implement a queue using two stacks?How do you implement a Stack and a Queue in JavaScript?How to do Async in Azure WebJob functionAzure Service Bus queue message handlingMy Azure function is not updated when I deploy itAzure function reading queue message twice from service busAzure Storage Queues and Message ShapeAzure storage queue/functions, dequeue from poison queue only onceQueue-trigger Azure Function: Queue messages processed more than onceAzure Function and storage queue

8086 stack segment and avoiding overflow in interrupts

Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?

Argand formula and more for quaternions?

What is the reason for cards stating "Until end of turn, you don't lose this mana as steps and phases end"?

GNU GPL V3 with no code change disclosure

What is the German equivalent of the proverb 水清ければ魚棲まず (if the water is clear, fish won't live there)?

Omnidirectional LED, is it possible?

Blank spaces in a font

Can I attune a Circlet of Human Perfection to my animated skeletons to allow them to blend in and speak?

How do I say "this is why…"?

Complexity of verifying optimality in (mixed) integer programming

How can I kill my goat?

Why force the nose of 737 Max down in the first place?

How do I find the FamilyGUID of an exsting database

Little Lost Robot

how to understand the error info "Illegal parameter number in definition of reserved@a. ...t2+cdots+sqrt2}}_n项 , cdots 收敛.$}"

Why does Canada require bilingualism in a lot of federal government posts?

Alternatives to minimizing loss in regression

Just how much information should you share with a former client?

A variant of the Multiple Traveling Salesman Problem

Is The Venice Syndrome documentary cover photo real?

Do the books ever say oliphaunts aren’t elephants?

How does a poisoned arrow combine with the spell Conjure Barrage?

Unknown indication below upper stave



Azure Function and queue


How to implement a queue using two stacks?How do you implement a Stack and a Queue in JavaScript?How to do Async in Azure WebJob functionAzure Service Bus queue message handlingMy Azure function is not updated when I deploy itAzure function reading queue message twice from service busAzure Storage Queues and Message ShapeAzure storage queue/functions, dequeue from poison queue only onceQueue-trigger Azure Function: Queue messages processed more than onceAzure Function and storage queue






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a function:



 public async static Task Run([QueueTrigger("efs-api-call-last-datetime", Connection = "StorageConnectionString")]DateTime queueItem,
[Queue("efs-api-call-last-datetime", Connection = "StorageConnectionString")]CloudQueue inputQueue,
TraceWriter log)
{


Then I have long process for processing message from queue. Problem is the message will be readded to queue after 30 seconds, while I process this message. I don't need to add this message and process it twice.
I would like to have code like:



 try

// long operation

catch(Exception ex)

// something wrong. Readd this message in 1 minute
await inputQueue.AddMessageAsync(new CloudQueueMessage(
JsonConvert.SerializeObject(queueItem)),
timeToLive: null,
initialVisibilityDelay: TimeSpan.FromMinutes(1),
options: null,
operationContext: null
);



and prevent to readd it automatically. Any way to do it?










share|improve this question






























    0















    I have a function:



     public async static Task Run([QueueTrigger("efs-api-call-last-datetime", Connection = "StorageConnectionString")]DateTime queueItem,
    [Queue("efs-api-call-last-datetime", Connection = "StorageConnectionString")]CloudQueue inputQueue,
    TraceWriter log)
    {


    Then I have long process for processing message from queue. Problem is the message will be readded to queue after 30 seconds, while I process this message. I don't need to add this message and process it twice.
    I would like to have code like:



     try

    // long operation

    catch(Exception ex)

    // something wrong. Readd this message in 1 minute
    await inputQueue.AddMessageAsync(new CloudQueueMessage(
    JsonConvert.SerializeObject(queueItem)),
    timeToLive: null,
    initialVisibilityDelay: TimeSpan.FromMinutes(1),
    options: null,
    operationContext: null
    );



    and prevent to readd it automatically. Any way to do it?










    share|improve this question


























      0












      0








      0








      I have a function:



       public async static Task Run([QueueTrigger("efs-api-call-last-datetime", Connection = "StorageConnectionString")]DateTime queueItem,
      [Queue("efs-api-call-last-datetime", Connection = "StorageConnectionString")]CloudQueue inputQueue,
      TraceWriter log)
      {


      Then I have long process for processing message from queue. Problem is the message will be readded to queue after 30 seconds, while I process this message. I don't need to add this message and process it twice.
      I would like to have code like:



       try

      // long operation

      catch(Exception ex)

      // something wrong. Readd this message in 1 minute
      await inputQueue.AddMessageAsync(new CloudQueueMessage(
      JsonConvert.SerializeObject(queueItem)),
      timeToLive: null,
      initialVisibilityDelay: TimeSpan.FromMinutes(1),
      options: null,
      operationContext: null
      );



      and prevent to readd it automatically. Any way to do it?










      share|improve this question














      I have a function:



       public async static Task Run([QueueTrigger("efs-api-call-last-datetime", Connection = "StorageConnectionString")]DateTime queueItem,
      [Queue("efs-api-call-last-datetime", Connection = "StorageConnectionString")]CloudQueue inputQueue,
      TraceWriter log)
      {


      Then I have long process for processing message from queue. Problem is the message will be readded to queue after 30 seconds, while I process this message. I don't need to add this message and process it twice.
      I would like to have code like:



       try

      // long operation

      catch(Exception ex)

      // something wrong. Readd this message in 1 minute
      await inputQueue.AddMessageAsync(new CloudQueueMessage(
      JsonConvert.SerializeObject(queueItem)),
      timeToLive: null,
      initialVisibilityDelay: TimeSpan.FromMinutes(1),
      options: null,
      operationContext: null
      );



      and prevent to readd it automatically. Any way to do it?







      queue azure-storage azure-functions message-queue azure-storage-queues






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 20:13









      Oleg ShOleg Sh

      3,2278 gold badges43 silver badges82 bronze badges




      3,2278 gold badges43 silver badges82 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          2














          There are couple of things here.



          1) When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them. By default, the batch size is 16. But this is configurable in Host.json. You can set the batch size to 1 if you want to minimize the parallel execution. Microsoft document explains this.



          2) As it is long running process so it seems your messages are not complete and the function might timeout and message are visible again. You should try to break down your function into smaller functions. Then you can use durable function which will chain the work you have to do.






          share|improve this answer
































            1














            Yes, you can dequeue same message twice.



            Reasons:



            1.Worker A dequeues Message B and invisibility timeout expires. Message B becomes visible again and Worker C dequeues Message B, invalidating Worker A's pop receipt. Worker A finishes work, goes to delete Message B and error is thrown. This is most common.



            2.The lock on the original message that triggers the first Azure Function to execute is likely expiring. This will cause the Queue to assume that processing the message failed, and it will then use that message to trigger the Function to execute again.



            3.In certain conditions (very frequent queue polling) you can get the same message twice on a GetMessage. This is a type of race condition that while rare does occur. Worker A and B are polling very quickly and hit the queue simultaneously and both get same message. This used to be much more common (SDK 1.0 time frame) under high polling scenarios, but it has become much more rare now in later storage updates (can't recall seeing this recently).



            1 and 3 only happen when you have more than 1 worker.



            Workaround:



            Install azure-webjobs-sdk 1.0.11015.0 version (visible in the 'Settings' page of the Functions portal). For more details, you could refer to fixing queue visibility renewals






            share|improve this answer



























              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%2f55365555%2fazure-function-and-queue%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              There are couple of things here.



              1) When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them. By default, the batch size is 16. But this is configurable in Host.json. You can set the batch size to 1 if you want to minimize the parallel execution. Microsoft document explains this.



              2) As it is long running process so it seems your messages are not complete and the function might timeout and message are visible again. You should try to break down your function into smaller functions. Then you can use durable function which will chain the work you have to do.






              share|improve this answer





























                2














                There are couple of things here.



                1) When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them. By default, the batch size is 16. But this is configurable in Host.json. You can set the batch size to 1 if you want to minimize the parallel execution. Microsoft document explains this.



                2) As it is long running process so it seems your messages are not complete and the function might timeout and message are visible again. You should try to break down your function into smaller functions. Then you can use durable function which will chain the work you have to do.






                share|improve this answer



























                  2












                  2








                  2







                  There are couple of things here.



                  1) When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them. By default, the batch size is 16. But this is configurable in Host.json. You can set the batch size to 1 if you want to minimize the parallel execution. Microsoft document explains this.



                  2) As it is long running process so it seems your messages are not complete and the function might timeout and message are visible again. You should try to break down your function into smaller functions. Then you can use durable function which will chain the work you have to do.






                  share|improve this answer













                  There are couple of things here.



                  1) When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them. By default, the batch size is 16. But this is configurable in Host.json. You can set the batch size to 1 if you want to minimize the parallel execution. Microsoft document explains this.



                  2) As it is long running process so it seems your messages are not complete and the function might timeout and message are visible again. You should try to break down your function into smaller functions. Then you can use durable function which will chain the work you have to do.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 27 at 10:01









                  DixitArora-MSFTDixitArora-MSFT

                  6905 bronze badges




                  6905 bronze badges


























                      1














                      Yes, you can dequeue same message twice.



                      Reasons:



                      1.Worker A dequeues Message B and invisibility timeout expires. Message B becomes visible again and Worker C dequeues Message B, invalidating Worker A's pop receipt. Worker A finishes work, goes to delete Message B and error is thrown. This is most common.



                      2.The lock on the original message that triggers the first Azure Function to execute is likely expiring. This will cause the Queue to assume that processing the message failed, and it will then use that message to trigger the Function to execute again.



                      3.In certain conditions (very frequent queue polling) you can get the same message twice on a GetMessage. This is a type of race condition that while rare does occur. Worker A and B are polling very quickly and hit the queue simultaneously and both get same message. This used to be much more common (SDK 1.0 time frame) under high polling scenarios, but it has become much more rare now in later storage updates (can't recall seeing this recently).



                      1 and 3 only happen when you have more than 1 worker.



                      Workaround:



                      Install azure-webjobs-sdk 1.0.11015.0 version (visible in the 'Settings' page of the Functions portal). For more details, you could refer to fixing queue visibility renewals






                      share|improve this answer





























                        1














                        Yes, you can dequeue same message twice.



                        Reasons:



                        1.Worker A dequeues Message B and invisibility timeout expires. Message B becomes visible again and Worker C dequeues Message B, invalidating Worker A's pop receipt. Worker A finishes work, goes to delete Message B and error is thrown. This is most common.



                        2.The lock on the original message that triggers the first Azure Function to execute is likely expiring. This will cause the Queue to assume that processing the message failed, and it will then use that message to trigger the Function to execute again.



                        3.In certain conditions (very frequent queue polling) you can get the same message twice on a GetMessage. This is a type of race condition that while rare does occur. Worker A and B are polling very quickly and hit the queue simultaneously and both get same message. This used to be much more common (SDK 1.0 time frame) under high polling scenarios, but it has become much more rare now in later storage updates (can't recall seeing this recently).



                        1 and 3 only happen when you have more than 1 worker.



                        Workaround:



                        Install azure-webjobs-sdk 1.0.11015.0 version (visible in the 'Settings' page of the Functions portal). For more details, you could refer to fixing queue visibility renewals






                        share|improve this answer



























                          1












                          1








                          1







                          Yes, you can dequeue same message twice.



                          Reasons:



                          1.Worker A dequeues Message B and invisibility timeout expires. Message B becomes visible again and Worker C dequeues Message B, invalidating Worker A's pop receipt. Worker A finishes work, goes to delete Message B and error is thrown. This is most common.



                          2.The lock on the original message that triggers the first Azure Function to execute is likely expiring. This will cause the Queue to assume that processing the message failed, and it will then use that message to trigger the Function to execute again.



                          3.In certain conditions (very frequent queue polling) you can get the same message twice on a GetMessage. This is a type of race condition that while rare does occur. Worker A and B are polling very quickly and hit the queue simultaneously and both get same message. This used to be much more common (SDK 1.0 time frame) under high polling scenarios, but it has become much more rare now in later storage updates (can't recall seeing this recently).



                          1 and 3 only happen when you have more than 1 worker.



                          Workaround:



                          Install azure-webjobs-sdk 1.0.11015.0 version (visible in the 'Settings' page of the Functions portal). For more details, you could refer to fixing queue visibility renewals






                          share|improve this answer













                          Yes, you can dequeue same message twice.



                          Reasons:



                          1.Worker A dequeues Message B and invisibility timeout expires. Message B becomes visible again and Worker C dequeues Message B, invalidating Worker A's pop receipt. Worker A finishes work, goes to delete Message B and error is thrown. This is most common.



                          2.The lock on the original message that triggers the first Azure Function to execute is likely expiring. This will cause the Queue to assume that processing the message failed, and it will then use that message to trigger the Function to execute again.



                          3.In certain conditions (very frequent queue polling) you can get the same message twice on a GetMessage. This is a type of race condition that while rare does occur. Worker A and B are polling very quickly and hit the queue simultaneously and both get same message. This used to be much more common (SDK 1.0 time frame) under high polling scenarios, but it has become much more rare now in later storage updates (can't recall seeing this recently).



                          1 and 3 only happen when you have more than 1 worker.



                          Workaround:



                          Install azure-webjobs-sdk 1.0.11015.0 version (visible in the 'Settings' page of the Functions portal). For more details, you could refer to fixing queue visibility renewals







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 27 at 9:21









                          Joey CaiJoey Cai

                          7,2621 gold badge2 silver badges11 bronze badges




                          7,2621 gold badge2 silver badges11 bronze badges






























                              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%2f55365555%2fazure-function-and-queue%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

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현