page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
Azure Spring Cloud Sample project for Storage Queue Integration client library |
azure-spring-integration-sample-storage-queue |
This code sample demonstrates how to use Spring Integration for Azure Storage Queue.
Running this sample will be charged by Azure. You can check the usage and bill at this link.
-
Create Azure Storage.
-
[Optional] if you want to use service principal, please follow create service principal from Azure CLI to create one.
-
[Optional] if you want to use managed identity, please follow create managed identity to set up managed identity.
-
Update stream binding related properties in [application.yaml]. If you choose to use service principal or managed identity, update the
application-sp.yaml
orapplication-mi.yaml
respectively.spring: cloud: azure: storage: account: [storage-account-name] access-key: [storage-account-access-key]
-
Update queue name in [SendController.java][send-controller] and [ReceiveController.java][receive-controller].
-
Run the
mvn spring-boot:run
in the root of the code sample to get the app running. -
Send a POST request
$ curl -X POST localhost:8080/messages?message=hello
-
Receive the message you posted
$ curl -X GET localhost:8080/messages
-
Verify in your app’s logs that a similar message was posted:
New message received: 'hello' Message 'hello' successfully checkpointed
-
Delete the resources on Azure Portal to avoid unexpected charges.
[send-controller]: https://github.com/Azure-Samples/azure-spring-boot-samples/blob/main/storage/azure-spring-cloud-starter-storage-queue/storage-queue-integration/ src/main/java/com/azure/spring/sample/storage/queue/SendController.java [receive-controller]: https://github.com/Azure-Samples/azure-spring-boot-samples/blob/main/storage/azure-spring-cloud-starter-storage-queue/storage-queue-integration/ src/main/java/com/azure/spring/sample/storage/queue/ReceiveController.java [application.yaml]: https://github.com/Azure-Samples/azure-spring-boot-samples/blob/main/storage/azure-spring-cloud-starter-storage-queue/storage-queue-integration/ src/main/resources/application.yaml