QueueTrigger 写入队列-Python
QueueTrigger to Write to Queue-Python
我有一个队列触发器,它读取 gis 要素图层并在它写回门户时对其进行处理。它似乎工作正常,除了消息没有记录到输出队列中。我说它工作正常,因为我可以在 gis 门户上看到正确编写的 gis 要素图层。我怀疑我的绑定不正常。我不一定需要写回生成的数据框。我所需要的只是存放在输出队列上的任何消息,以便为其他进程提供资源。不能 post 这里的整个代码出于隐私考虑但我的主文件 (init_py) 可以被认为是:
import logging
import json
import pandas
def main(msg: func.QueueMessage, msg1: func.Out[str]) -> None:
logging.info('Python queue trigger function processed a queue item: %s',
msg.get_body().decode('utf-8'))
x=1
y=1
df=x=1
msg1.set(df)
我的function.host
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "queueTrigger",
"direction": "in",
"queueName": "outqueue12",
"connection": "storageaccountautom92bb_STORAGE"
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"type": "queue",
"direction": "out",
"name": "msg1",
"queueName": "outqueue13",
"connection": "AzureStorageQueuesConnectionString"
}
]
}
绑定接受字符串类型和字节类型,所以下面的代码应该可以工作:
__init__.py
import logging
import azure.functions as func
def main(msg: func.QueueMessage, msg2: func.Out[str]) -> None:
num1 = 1
num2 = 1
str1 = num1+num2
msg2.set(str(str1))
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "queueTrigger",
"direction": "in",
"queueName": "test1",
"connection": "0730bowmanwindow_STORAGE"
},
{
"type": "queue",
"direction": "out",
"name": "msg2",
"queueName": "test2",
"connection": "0730bowmanwindow_STORAGE"
}
]
}
我有一个队列触发器,它读取 gis 要素图层并在它写回门户时对其进行处理。它似乎工作正常,除了消息没有记录到输出队列中。我说它工作正常,因为我可以在 gis 门户上看到正确编写的 gis 要素图层。我怀疑我的绑定不正常。我不一定需要写回生成的数据框。我所需要的只是存放在输出队列上的任何消息,以便为其他进程提供资源。不能 post 这里的整个代码出于隐私考虑但我的主文件 (init_py) 可以被认为是:
import logging
import json
import pandas
def main(msg: func.QueueMessage, msg1: func.Out[str]) -> None:
logging.info('Python queue trigger function processed a queue item: %s',
msg.get_body().decode('utf-8'))
x=1
y=1
df=x=1
msg1.set(df)
我的function.host
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "queueTrigger",
"direction": "in",
"queueName": "outqueue12",
"connection": "storageaccountautom92bb_STORAGE"
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"type": "queue",
"direction": "out",
"name": "msg1",
"queueName": "outqueue13",
"connection": "AzureStorageQueuesConnectionString"
}
]
}
绑定接受字符串类型和字节类型,所以下面的代码应该可以工作:
__init__.py
import logging
import azure.functions as func
def main(msg: func.QueueMessage, msg2: func.Out[str]) -> None:
num1 = 1
num2 = 1
str1 = num1+num2
msg2.set(str(str1))
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "queueTrigger",
"direction": "in",
"queueName": "test1",
"connection": "0730bowmanwindow_STORAGE"
},
{
"type": "queue",
"direction": "out",
"name": "msg2",
"queueName": "test2",
"connection": "0730bowmanwindow_STORAGE"
}
]
}