Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
page_type languages products description urlFragment
sample
java
azure-queue-storage
Azure Spring Cloud Sample project for Storage Queue Operation client library
azure-spring-cloud-sample-storage-queue-operation

Spring Cloud Azure Storage Queue Operation Code Sample shared library for Java

Key concepts

This code sample demonstrates how to use Storage Queue Operation.

Getting started

Running this sample will be charged by Azure. You can check the usage and bill at this link.

Create Azure resources

  1. Create Azure Storage.

  2. [Optional] if you want to use service principal, please follow create service principal from Azure CLI to create one.

  3. [Optional] if you want to use managed identity, please follow create managed identity to set up managed identity.

Examples

  1. Update stream binding related properties in application.yaml. If you choose to use service principal or managed identity, update the application-sp.yaml or application-mi.yaml respectively.

    spring:
      cloud:
        azure:
          storage:
            account: [storage-account-name]
            access-key: [storage-account-access-key]
  2. Update queue name in WebController.java.

  3. Run the mvn spring-boot:run in the root of the code sample to get the app running.

  4. Send a POST request

    $ curl -X POST localhost:8080/messages?message=hello
    
  5. Receive the message you posted

    $ curl -X GET localhost:8080/messages
    
  6. Verify in your app’s logs that a similar message was posted:

    Message arrived! Payload: hello
    Message 'hello' successfully checkpointed
    
  7. Delete the resources on Azure Portal to avoid unexpected charges.

Troubleshooting

Next steps

Contributing