[英]How do I create/connect to a Docker Azure service bus (using Python SDK)?
I'm using the Python 3.8 SDK for Azure service bus, (azure-servicebus v. 0.50.3).我将 Python 3.8 SDK 用于 Azure 服务总线,(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?如何创建运行服务总线的 Docker 图像,其中已创建一个或两个主题? 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.但我不清楚如何使用我拥有的代码连接到它,或者以上是否是有效的服务总线图像。
Azure Service Bus does not provide a docker image. Azure 服务总线不提供 docker 图像。 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 .您使用的图像 (
microsoft/azure-storage-emulator
) 适用于 Azure 存储系统,它可以提供与Azure 存储队列类似的排队功能。 For more details check out How to use Azure Queue storage from Python .有关更多详细信息,请查看如何使用 Azure 来自 Python 的队列存储。
If you need to use Azure Service Bus locally, check out the GitHub Issue: Local Development story?如果您需要在本地使用 Azure 服务总线,请查看GitHub 问题:本地开发故事? .
. TLDR: Use AMQP libraries and connect to another AMQP provider for local, and swap out for Service Bus in production.
TLDR:使用 AMQP 库并连接到本地的另一个 AMQP 提供程序,并在生产中换出服务总线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.