I結合サービスバス(トピック)出力を持っているPythonで書かれたAzureの機能を持っています。この関数は別のキューによってトリガされ、Blobストレージからいくつかのファイルを処理し、別のメッセージをキューに入れます。Azureの機能 - Pythonの - ServiceBus出力は、バインディング - カスタムプロパティの設定
マイfunction.jsonファイルは以下のようになります。私の機能で
{
"bindings": [
{
"type": "serviceBus",
"connection": "Omnibus_Input_Send_Servicebus",
"name": "outputMessage",
"queueName": "validation-output-queue",
"accessRights": "send",
"direction": "out"
}
],
"disabled": false
}
が、私はそのような別のキューにメッセージを送ることができます:それは正常に動作している
with open(os.environ['outputMessage'], 'w') as output_message:
output_message.write('This is my output test message !')
。今私はトピックにメッセージを送信したいと思います。私はSQLFilter
とサブスクリプションを作成していると私はBrokeredMessage
にいくつかのカスタムプロパティを設定する必要があります。 azure sdk for pythonから
、私は(私はピップを使用して紺碧のモジュールをインストールした)そのようにカスタムプロパティを追加できることを発見しました:
from azure.servicebus import Message
sent_msg = Message(b'This is the third message',
broker_properties={'Label': 'M3'},
custom_properties={'Priority': 'Medium',
'Customer': 'ABC'}
)
私の新しいfunction.jsonファイルは以下のようになります。
{
"bindings": [
{
"type": "serviceBus",
"connection": "Omnibus_Input_Send_Servicebus",
"name": "outputMessage",
"topicName": "validation-output-topic",
"accessRights": "send",
"direction": "out"
}
],
"disabled": false
}
そして私はそのように私の機能を変更しました:私は実行すると
from azure.servicebus import Message
sent_msg = Message(b'This is the third message',
broker_properties={'Label': 'M3'},
custom_properties={'Priority': 'Medium',
'Customer': 'ABC'}
)
with open(os.environ['outputMessage'], 'w') as output_message:
output_message.write(sent_msg)
実際の結合がどのように対処するBrokeredMessageとをサポートしている場合
TypeError: cannot make memory view because object does not have the buffer interface
私は疑問に思って:
TypeError: expected a string or other character buffer object
は、私がbuffer
とmemoryview
機能を使用しますが、まだ別の例外を取得しようとしました:機能、私はこの例外を取得しますそれと ? Pythonの(および他のスクリプト言語)のための結合
あなたは試してみました申し訳ありません –
[broker_propertiesは= '{ "ForcePersistence": "マイラベル":偽、 "ラベル"}' sent_msg =メッセージ(b'receiveメッセージ」、 broker_propertiesの=のbroker_properties を)]それは将来実現される予定ですか? git repoで問題を開くべきですか? – Thomas