:param partition: The specific partition ID to send to. Default is None, in which case the service
will assign to all partitions using round-robin.
:type partition: str
def open(self):
"""
Open the Sender using the supplied conneciton.
If the handler has previously been redirected, the redirect
context will be used to create a new handler before opening it.
:param connection: The underlying client shared connection.
:type: connection: ~uamqp.connection.Connection
"""
self.running = True
if self.redirected:
self.target = self.redirected.address
self._handler = SendClient(
self.target,
auth=self.client.get_auth(),
debug=self.client.debug,
msg_timeout=self.timeout,
error_policy=self.retry_policy,
keep_alive_interval=self.keep_alive,
client_name=self.name,
properties=self.client.create_properties())
self._handler.open()
while not self._handler.client_ready():
time.sleep(0.05)
这是初始化
^{pr2}$
我相信,下面的函数行只会创建一个分区发送器
if partition:
self.target += "/Partitions/" + partition
self.name += "-partition{}".format(partition)
有两种方法可以将数据发送到Azure事件中心,即httprestapi和amqp1.0协议。在
对于使用httprestapi或Azure EventHub Python Client Library,只有
partitionId
参数支持将新事件发送到事件集线器中的指定分区,如下所示。在restapi^{} 需要端点
https://{servicebusNamespace}.servicebus.windows.net/{eventHubPath}/partitions/{partitionId}/messages
中的partitionId
参数,它是唯一一个支持发送分区功能的REST API。Sender.py
的源代码注释解释了^{所以实际上,除了在Python中使用amqp1.0之外,不能使用} ,并在页面上搜索
partitionKey
值将事件发送到指定的EventHub分区。要使用amqp1.0,请参阅官方文档^{partition-key
,结果如下。在我不太确定,但是使用python,这里是打开连接的方法
这是初始化
^{pr2}$我相信,下面的函数行只会创建一个分区发送器
参考
https://github.com/Azure/azure-event-hubs-python/blob/master/azure/eventhub/sender.py
希望有帮助。在
相关问题 更多 >
编程相关推荐