Connect To Azure Queue Storage in Spring Boot

In my previous video , we have explained the steps to create queue storage in azure portal . If you not created please follow the steps here-https://kbtutorials.in/2024/03/30/steps-to-create-azure-storage-account/

Here are the steps :

1)Please create a spring boot application if not presented –https://start.spring.io/

2)Add below dependencies –

<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-dependencies</artifactId>
<version>5.10.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.azure/azure-storage-queue -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-queue</artifactId>
<version>12.20.2</version>
</dependency>

3) We are going to use QueueClient object to connect azure storage queue with spring boot. like below .

@Bean
public QueueClient getQueueClient(){
QueueClient client = new QueueClientBuilder()
.endpoint("Queue End point")
.queueName("Queue Name")
.sasToken("sas token")
.buildClient();
client.createIfNotExists();
return client;
}

Here we need to identify few fields like

  1. EndPoint – Go to Storage account overview- click on View in Json Mode.

In Json will be opened in new tab. There you can see the

2) Queue Name is the storage Queue you have created.

3)To Get SAS End point – Click on Shared Access Signature.

  • Select allowed resource types as Service ,Container and Object provide end date then click on generate sas token . Then copy that sas token url use it in QueueClient object.

Please use below tutorial for more details-

Loading


Comments

One response to “Connect To Azure Queue Storage in Spring Boot”

Leave a Reply

Your email address will not be published. Required fields are marked *