AnswerBun.com

How do I create/connect to a Docker Azure service bus (using Python SDK)?

Stack Overflow Asked on December 15, 2020

I’m using the Python 3.8 SDK for Azure service bus, (azure-servicebus v. 0.50.3). I use the following code to send a message to a topic …

service = ServiceBusService(service_namespace,
                        shared_access_key_name=key_name,
                        shared_access_key_value=key_value)
msg = Message(json.dumps({'type': 'my_message'}))
service.send_topic_message(topic_name, msg)

How do I create a Docker image that runs the service bus with a topic or two already created? I found this image

version: '3.7'

services:
    azure_sb:
        container_name: azure_sb
        image: microsoft/azure-storage-emulator
        tty: true
        restart: always
        ports:
            - "10000:10000"
            - "10001:10001"
            - "10002:10002"

but I’m unclear how to connect to it using the code I have or if the above is even a valid service bus image.

One Answer

Azure Service Bus does not provide a docker image. The image that you are using (microsoft/azure-storage-emulator) is for the Azure Storage system, which can provide similar queuing capabilities with Azure Storage Queues. For more details check out How to use Azure Queue storage from Python.

If you need to use Azure Service Bus locally, check out the GitHub Issue: Local Development story?. TLDR: Use AMQP libraries and connect to another AMQP provider for local, and swap out for Service Bus in production.

Answered by joncloud on December 15, 2020

Add your own answers!

Related Questions

Array to string conversion when using heredoc syntax

2  Asked on December 17, 2020 by icecub

     

Rewrite rules for angular and express server

0  Asked on December 17, 2020 by mirzet-zukic

       

I want to achieve this cursor interaction

1  Asked on December 16, 2020 by abdelhamied-mostafa

       

How to remove nested(child) items in List using Linq?

1  Asked on December 16, 2020 by kamil

       

Pose Detection for squat with count using ML Kit

2  Asked on December 16, 2020 by shweta-chauhan

       

HTMLAudioElement: decoding without throttling

0  Asked on December 16, 2020 by joe-meadows

   

diffrent serial no for each ID in MSSQL

1  Asked on December 16, 2020 by akash-singh

     

How can I generate a number between 1 and 3 in a for loop?

2  Asked on December 16, 2020 by user14050624

   

What does this bitwise operation perform?

3  Asked on December 16, 2020 by sudhip-nashi

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir