In our previous tutorial we have learnt, how to connect with azure queue storage with spring boot using Queue client. Here is the link for article.
https://kbtutorials.in/2024/04/08/connect-to-azure-queue-storage-in-spring-boot/
Now we will learn , How to send and receive message from azure storage queue using queue client in spring boot.
Send Message:
We have method called sendMessage(text) on queue client , it can help to send message to provided queue .
we take message you want to sent to as parameter to sendMessage in QueueClient object. This will return SendMessageResult object. You can see in the attached image i am getting messageId for each message i have given.
Receiving Message:
In QueueClient object itself we have method called receiveMessage().
This will return the messages from queue into object called QueueMessageItem
In QueueMessageItem there is getBody() method will return the text message we have already sent.
Code link :https://github.com/kbtutorials/AzureStorageQueueSpringBoot
This video migh help .
Leave a Reply