python / python-docs-zh-tw

Traditional Chinese (zh-tw) translation of the Python Documentation
https://docs.python.org/zh-tw/
Other
247 stars 208 forks source link

Not able to listen the events that publish to topic #619

Closed yamanbansal7499 closed 1 year ago

yamanbansal7499 commented 1 year ago

Struggling with the python azure eventGrid function in durable function app . I am using ready templates created from azure for python.. I had created a POST azure durable function app when the durable function app hitted the event publish to event grid topic using the below notification code in host.json file ... and created azure grid function app that listen for events ( init.py and functions.json) and Added an Event Grid subscription for the Event Grid topic that I have created..

The problem is that using the below code I am not able to listen the events that triggered to topic.. please let me know how to listen the event message through below code

I am referring this Page: https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-event-publishing?tabs=csharp-script

---- host.json ---- { "version": "2.0", "logging": { "applicationInsights": { "samplingSettings": { "isEnabled": true, "excludedTypes": "Request" } } }, "extensions": { "durableTask": { "notifications": { "eventGrid": { "topicEndpoint": "https://.westus2-1.eventgrid.azure.net/api/events", "keySettingName": "EventGridKey" } } } }, "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[2.*, 3.0.0)" } }

(init.py)

import json import logging

import azure.functions as func

def main(event: func.EventGridEvent):

result = json.dumps( { "id": event.id, "data": event.get_json(), "topic": event.topic, "subject": event.subject, "event_type": event.event_type, } )

logging.info("Python EventGrid trigger processed an event: %s", result) --- function.json --- { "bindings": [ { "type": "eventGridTrigger", "name": "event", "direction": "in" } ], "disabled": false, "scriptFile": "init.py" }

Any help will be appreciated!

mattwang44 commented 1 year ago

Hi @yamanbansal7499 This repo is for the Traditional Chinese translation of Python documents and has nothing to do with Azure. I guess https://github.com/Azure/Azure-Functions would be the correct place to file an issue.