Azure / azure-functions-kafka-extension

Kafka extension for Azure Functions
MIT License
114 stars 81 forks source link

Output binding example for Python #181

Open amotl opened 4 years ago

amotl commented 4 years ago

Hi there,

thank you so much for providing Azure bindings for Kafka. Our scenario is that we use Python to consume events from Azure Event Hubs using its trigger binding and want to write events to both CrateDB and Kafka.

While there is a snippet within the README outlining how to use the output binding with C# [1], we are humbly asking if you can guide us how to use the output binding with Python, similar to [2]. However, we would like to use it in the style as outlined within [3].

With kind regards, Andreas.

[1] https://github.com/Azure/azure-functions-kafka-extension#output-binding [2] https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-output?tabs=python [3] https://stackoverflow.com/a/61734403

TsuyoshiUshio commented 4 years ago

Thank you for the request. I'd like to consider to add sample.

amotl commented 4 years ago

Dear Tsuyoshi,

now that we've resolved #185 and #187 (thanks again!) can I humbly ask you about this again?

With kind regards, Andreas.

amotl commented 4 years ago

Dear @TsuyoshiUshio,

having a respective example at hand would be really helpful for us. Do you think you can afford the time to churn out something into the direction outlined above? Maybe @mym-kingbob would also be able to help?

With kind regards, Andreas.

TsuyoshiUshio commented 4 years ago

Hi @amotl It is not isolated sample, however, I wrote E2E testing for the python function as well. The Python functions part includes E2E testing with output bindings.

https://github.com/Azure/azure-functions-kafka-extension/pull/199 https://github.com/Azure/azure-functions-kafka-extension/tree/tsushi/e2elanguage/test/Microsoft.Azure.WebJobs.Extensions.Kafka.LangEndToEndTests/server/python38/kafka_output

amotl commented 4 years ago

Dear Tsuyoshi,

thanks a bunch for providing these examples on behalf of e2e tests.

With kind regards, Andreas.

tech7857 commented 2 years ago

Hello @TsuyoshiUshio @shrohilla

I am writing any output binding for Python, I am seeing few things

  1. Now able to pass key - I see there is a pending PR for this.
  2. I am unable to retrieve the partition and offset of where the message was posted. Also, in case of any error it is not very descriptive like it doesnt mention what is the actual issue. Can you please let us know if partition and offset can be retrieved or I am missing anything.

Thanks for the help.