Skip to content

Latest commit

 

History

History

02-servicebus

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Create Azure resources

  1. Clone the repo locally
  2. Run
    cd reactor-ais/02-servicebus
  3. Update infra.azcli with your resource group name, namespace name, location and queue name.
  4. Run
    . infra.cli

After the environment is created, move to the next step.

Setup Python environment and files

Setup Connection String

export SERVICEBUS_CONN_STR=$(az servicebus namespace authorization-rule keys list --resource-group $RESOURCE_GROUP --namespace-name $NAMESPACE_NAME --name RootManageSharedAccessKey --query primaryConnectionString --output tsv)
export QUEUE_NAME=$QUEUE_NAME

Install dependencies

pip install azure-servicebus

Running the demo

First, run sender.py to send messages to the queue.

python sender.py

Then, run receiver.py to receive messages from the queue.

python receiver.py

On the Azure Portal, open your Azure Service bus instance and Queue. Navigate to Service Bus Explorer to see the messages being consumed and sent in real-time.

Cleanup resources

az group delete --name $RESOURCE_GROUP