I have a TimerTrigger function that runs every couple minutes and adds multiple items to a queue, which a QueueTrigger function should process. But each time the QueueTrigger function is firing only once.
my TimerTrigger function:
def main(mytimer: func.TimerRequest, msg: func.Out[str]) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
msg.set("1")
msg.set("2")
QueueTrigger function:
def main(msg: func.QueueMessage) -> None:
logging.info('Python queue trigger function processed a queue item: %s',
msg.get_body().decode('utf-8'))
function.json of the TimerTrigger:
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "mytimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */2 * * * *"
},
{
"name": "msg",
"type": "queue",
"direction": "out",
"queueName": "js-queue-items",
"connection": "AzureWebJobsStorage"
}
]
}
function.json of the QueueTrigger:
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "queueTrigger",
"direction": "in",
"queueName": "js-queue-items",
"connection": "AzureWebJobsStorage"
}
]
}
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
How can I fix this?