Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Service Bus] Cancel a message in a queue by sequenceNumber #25081

Open
YHAMSTM opened this issue Mar 3, 2023 · 4 comments
Open

[Service Bus] Cancel a message in a queue by sequenceNumber #25081

YHAMSTM opened this issue Mar 3, 2023 · 4 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Bus

Comments

@YHAMSTM
Copy link

YHAMSTM commented Mar 3, 2023

Is your feature request related to a problem? Please describe.
Hello,
My current work using Service Bus is to provide a producer/consumer scheme by scheduling works for a set of workers.
When an user schedule a work, a message is directly published in a queue.

Since workers can take some time to be available, an user can be frustated and may want to cancel its current work.

Describe the solution you'd like
As currently available with scheduledMessages, I would like to have the same function as cancelScheduledMessages for messages already available in queue.

Currently it relies on "receiveMessages" and "abandonMessage", but it increases the number of "delivered". It should not on this use-case.
Describe alternatives you've considered
To do so, I would like to be able to cancel(), or complete() a message by its sequenceNumber.
Example:

    const sbClient = new ServiceBusClient(AZURE_SERVICEBUS_CONNECTION_STRING, sbOptions);
    const queueReceiver = sbClient.createReceiver(queueName, { receiveMode: 'peekLock' });
    const queueSender = sbClient.createSender(queueName);
    try {
        let canceled = false;
        for (const message of await queueReceiver.peekMessages(1000)) {
            const { shouldBeCanceled } = message.body;
            if (shouldBeCanceled && message.sequenceNumber) {
                await queueReceiver.cancelMessages(message.sequenceNumber);
                /* or: await queueSender.cancelMessages(message.sequenceNumber); */
                canceled = true;
            }
        }
        return { canceled, message: canceled ? 'Message deleted' : 'Message does not exist' };

    }
    catch (err: unknown) {
        if (isError(err)) {
            return { canceled: false, message: 'Error while deleting message: ' + err.message };
        } 
        return { canceled: false };
    } finally {
        await queueReceiver.close();
        await queueSender.close();
        await sbClient.close();
    }

Additional context
Add any other context or screenshots about the feature request here.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 3, 2023
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 3, 2023
@xirzec xirzec added Client This issue points to a problem in the data-plane of the library. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Mar 3, 2023
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 3, 2023
@jeremymeng jeremymeng added feature-request This issue requires a new behavior in the product in order be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 3, 2023
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Mar 3, 2023
@jeremymeng
Copy link
Member

@YHAMSTM thank you for submitting this issue! To clarify, you would like remove/delete a message from the queue by its sequence number? This operation isn't supported by the Azure Service Bus service today but I will forward this feedback to the service team for consideration.

@YHAMSTM
Copy link
Author

YHAMSTM commented Mar 6, 2023

Hi @jeremymeng
Yes, exactly. I would like to have the ability to receive, complete or cancel a message by its sequence number.
Since my current way to "cancel" is by receiving a batch of messages in queue (with peekLock), complete the message I want to cancel and abandon messages I want to let in queue. With this, raising "maxDeliveryCount" is mandatory...

@jeremymeng
Copy link
Member

@YHAMSTM the service team has planned features that may enable this scenario. But we don't have any ETA on when this will be available.

@YHAMSTM
Copy link
Author

YHAMSTM commented May 25, 2023

Great news!

azure-sdk pushed a commit to azure-sdk/azure-sdk-for-js that referenced this issue Aug 22, 2023
[Hub Generated] Review request for Microsoft.ContainerService/aks to add version preview/2023-07-02-preview (Azure#25254)

* Adds base for updating Microsoft.ContainerService/aks from version preview/2023-06-02-preview to version 2023-07-02-preview

* Updates readme

* Updates API version in new specs and examples

* update readmes (Azure#25049)

* add new field resourceUID to managed cluster properties (Azure#25069)

* add new field resourceUID to managed cluster properties

https://msazure.visualstudio.com/CloudNativeCompute/_git/aks-rp/pullrequest/8416789

* update description

* Mark guardrailsProfile Version as not required (Azure#25081)

* Mark guardrailsProfile Version as not required

* Run prettier

---------

Co-authored-by: Nick Keller <[email protected]>

* Swagger Changes for Multiple DNS Zones for Web App Routing (Azure#25064)

* added web app routing changes for multiple dns zones

* modified examples

* Changes for unified azuremonitorprofile in Microsoft.ContainerService (Azure#25063)

* Changes for unified azuremonitorprofile

* Update prettier changes

* Update specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-07-02-preview/managedClusters.json

Co-authored-by: FumingZhang <[email protected]>

* Update specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-07-02-preview/managedClusters.json

Co-authored-by: FumingZhang <[email protected]>

---------

Co-authored-by: Janvi Jatakia (from Dev Box) <[email protected]>
Co-authored-by: FumingZhang <[email protected]>

* Add cost analysis to AKS preview Swagger (Azure#25082)

* update preview API to follow GA api - use one forceupgrade boolean in… (Azure#25099)

* update preview API to follow GA api - use one forceupgrade boolean instead of multiple overrides

* update msg

---------

Co-authored-by: Wenjun Gao <[email protected]>

* Mark trusted access role binding PUT and DELETE operation as async (Azure#25112)

* Mark trusted access role binding PUT and DELETE operation as async

* fix CI: update TA oepration's error to common type error

* Swagger for Machine API (Azure#25180)

* Swagger for Machine List, Get API

Related work items: #24759018

* Update managedClusters.json

* Update managedClusters.json

* Update MachineGet.json

adding new line

* Update MachineList.json

* Update managedClusters.json

* Update managedClusters.json

* Update managedClusters.json

* swagger: machine api

* swagger: machine api

* swagger:machine api

* swagger: machine api

* swagger: machine api

* swagger: machine api

* Update specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-07-02-preview/managedClusters.json

Co-authored-by: FumingZhang <[email protected]>

* swagger: machine api

* swagger: machine api

* swagger:  machine api

* swagger:machine api

* swagger:machine api

* swagger:machine api

---------

Co-authored-by: FumingZhang <[email protected]>

* Adding Guardrails version to public swagger (Azure#25085)

* Adding Guardrails version to public swagger

* renamed GetGuardrailsVersions.json

* Applied GetCollectionResponseSchema rule

* Ran prettier fix

* Minor change

* moving parametre into managedClusters.json

* GuardrailsAvailableVersion model change

* Updated version param reference

* Swagger SemanticValidation fix

* model changes

* prettier fix

* Added version in list response

* Changed  to resource in GET and added descriptions where needed

* Removed identifier in GuardrailsAvailableVersionsList

---------

Co-authored-by: Sindhuja Salla <[email protected]>

* Remove overlay vpa unused properties (Azure#25242)

* remove unused properties

* only remove from required section

* remove the whole properties

---------

Co-authored-by: zhifanhui <[email protected]>

* asm: update examples to use asm- prefix for revisions (Azure#25247)

* Revert "Mark trusted access role binding PUT and DELETE operation as async (Azure#25112)" (Azure#25233)

This reverts commit db24ef8bfbf6b214310af0872a923130e27ae1b6.

* fix AgentPoolNameParameter location

* Fuming zhang containerservice microsoft.container service 2023 07 02 preview (Azure#25433)

* adding requested properties.

* adding requested properties

* prettier check

* removing read-only constraint

---------

Co-authored-by: daru__ <[email protected]>
Co-authored-by: Nick Keller <[email protected]>
Co-authored-by: Nick Keller <[email protected]>
Co-authored-by: Jaiveer Katariya <[email protected]>
Co-authored-by: Janvi Jatakia <[email protected]>
Co-authored-by: Janvi Jatakia (from Dev Box) <[email protected]>
Co-authored-by: Matthew Christopher <[email protected]>
Co-authored-by: Wenjun Gao <[email protected]>
Co-authored-by: Wenjun Gao <[email protected]>
Co-authored-by: Tongyao Si <[email protected]>
Co-authored-by: sushmak295 <[email protected]>
Co-authored-by: sallasindhuja <[email protected]>
Co-authored-by: Sindhuja Salla <[email protected]>
Co-authored-by: huizhifan <[email protected]>
Co-authored-by: zhifanhui <[email protected]>
Co-authored-by: Sanya Kochhar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Bus
Projects
Status: No status
Development

No branches or pull requests

3 participants