Azure-docs: registerMessageHandler @Deprecated

Created on 4 Mar 2020  ·  10Comments  ·  Source: MicrosoftDocs/azure-docs

The example is currently using the 1st method which is @Deprecated. Looks like it should be switched over to the 2nd method? 🤔 What's an ExecutorService though?

@Deprecated
@Override
public void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions) throws InterruptedException, ServiceBusException {
    this.messageAndSessionPump.registerMessageHandler(handler, handlerOptions);
}

@Override
public void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions, ExecutorService executorService) throws InterruptedException, ServiceBusException {
    this.messageAndSessionPump.registerMessageHandler(handler, handlerOptions, executorService);
}

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 cxp doc-enhancement service-bus-messaginsvc triaged

All 10 comments

@spottedmahn Thank you for your feedback! We will review and update as appropriate.

@spottedmahn This doesn't appear to be the case per: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/MessageHandlerOptions.java

We will now proceed to close this thread for now. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

registerMessageHandler isn't in the source file you referenced, 🤔

I believe this is the correct source code, SubscriptionClient.registerMessageHandler, referenced in the sample.

image

Hi @mike-urnun-msft - can you re-review and re-open this? thanks! 🙏

registerMessageHandler isn't in the source file you referenced, 🤔

@spottedmahn checking... will update you shortly ;)

Hi team,
How is the state of this issue, any update?
Could you also update the example as well: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-java-how-to-use-topics-subscriptions#how-to-receive-messages-from-a-subscription
Thanks.

@spottedmahn @kensonwu1 The ExecutorService class used here is the java.util.concurrent.ExecutorService class used for asynchronous concurrent execution.

I believe the intent of the new methods is to expose this as a parameter for customization but you could simply pass ForkJoinPool.commonPool() used in the deprecated method to care of the lint error or use another built-in executor.

For example, if you would want to ensure messages are processing sequentially, you could use Executers.newSingleThreadExecuter.

Hope that information helps, and we are assigning this issue to include samples for the same in the docs.

thanks for reviewing @PramodValavala-MSFT 👍

in-progress

Updated the code.

please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrdfuse picture mrdfuse  ·  3Comments

spottedmahn picture spottedmahn  ·  3Comments

DeepPuddles picture DeepPuddles  ·  3Comments

Agazoth picture Agazoth  ·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  ·  3Comments