This project illustrates how you can interact with Azure Service Bus using (MicroProfile Reactive Messaging)[https://github.com/freedev/smallrye-reactive-messaging].
First you need a Azure Service Bus. You can follow the instructions from the Azure Service Bus Documentation .
From the Azure Portal:
- create a Service Bus - Azure Documentation
- create a Service Bus Topic and Subscription - Azure Documentation
- create a Shared access policy and copy the connection string
Then configure properly the file src/main/resources/application.properties
fixing the:
topic-name
topic-name-subcription
- and
connectionString
parameter
mp.messaging.incoming.source-in.endpoint-uri=azure-servicebus:topic-name?subscriptionName=topic-name-subscription&amqpTransportType=AmqpWebSockets&serviceBusType=topic&connectionString=Endpoint=sb://my-azuresb.servicebus.windows.net/;SharedAccessKeyName=camelTest;SharedAccessKey=XXXXXXXXXXXXXXXX=;EntityPath=topic-name
The application can be started using:
mvn package quarkus:dev
Then, looking at the output you can see messages successfully read from a Azure Service Bus topic.
The application is composed by 1 components:
MyReactiveMessagingApplication
- a bean receiving topic messages.
The interaction with Azure Service Bus is managed by MicroProfile Reactive Messaging.
The configuration is located in the microprofile config properties the file src/main/resources/application.properties
.