azure service bus - java spring - How to make run MessageReceiver continuously in the background to keep receiving messages from a subscription.

Arsh 0 Reputation points
2023-12-17T17:18:12.3866667+00:00

Hi,
I am using "Azure Service Bus" to send-and-receive messages to topics.

Important : The topics are session-enabled.

I am using spring-boot (in Java-11).

Question : I want to create a Client/mechanism that keeps on running forever in the background and keeps on receiving messages in the time.

I have tried ServiceBusProcessorClient and ServiceBusSessionReceiverAsyncClient , but both receive messages 1 at a time and they need to be re-triggered.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 29,266 Reputation points
    2024-01-02T17:00:50.88+00:00

    @Arsh Thanks for your patience! Could you please refer this doc:https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/using-service-bus-in-spring-applications this document does provide sample code demonstrates how to create a message listener using the Spring Framework for Java. This listener can be configured to receive messages from a Service Bus queue or topic continuously, as long as the application is running.

    let me know incase of further queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.