简体   繁体   English

如何创建/连接到 Docker Azure 服务总线(使用 Python SDK)?

[英]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.

相关问题 在 Azure 的 Python 服务总线 SDK 中,如何查询命名空间的共享访问策略? - In Azure's Python service bus SDK, how do I query the shared access policies of a namespace? 如何使用 Python SDK 为我在 Azure 数据湖中创建的文件设置到期日期? - How do I set an expiration date on a file I create in the Azure Data lake using the Python SDK? 如何使用 Python 从 Azure 服务总线读取消息? - How to read message from Azure Service Bus using Python? 使用python在Azure服务总线中实现队列 - Implementation of a queue in Azure service bus using python 如何从 Azure 服务总线读取大量消息 - 使用 Python 订阅? - How to read bunch of message from Azure Service Bus - subscription using Python? 如何使用 Python 从 Azure 服务总线主题读取所有消息? - How to read all message from Azure Service Bus topic using Python? 使用新的 Azure 服务总线 SDK (7.0.0),创建主题、订阅和授权规则的正确方法是什么? - With the new Azure service bus SDK (7.0.0), what's the proper way to create a topic, subscription, and authorization rule? 如何使用Python3连接到在Mac上的docker中运行的SQL Server? - How do I connect to SQL Server running inside docker on mac using Python3? 如何进入 docker 容器并使用 Paramiko 模块在 Python 中重新启动服务? - How do I go inside a docker container and restart a service in Python using Paramiko module? 如何在 Azure App Service 环境中执行长时间运行的 python 服务总线轮询作业 - How to execute a long running python service bus polling job in Azure App Service environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM