1

I have a queuetrigger which reads a gis feature layer and process its as it writes back to portal. It seems to work alright except the message is not logged onto the outqueue. I say it works alright because I can see the gis featurelayer properly written on the gis portal. I suspect my bindings aren't alright. I don't need to necessarily have the resulting dataframe written back. All I need is any message deposited on the outqueue to resource other processes. Cant post whole code here for privacy but My main file (init_py) can be thought of as:

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)
    

My 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"
    }
  ]
}
wwnde
  • 26,119
  • 6
  • 18
  • 32

1 Answers1

2

binding accept string type and bytes type, so below code should work:

__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"
    }
  ]
}
Cindy Pau
  • 13,085
  • 1
  • 15
  • 27