Azure函数 - python中的事件中心触发器函数 [英] Azure Functions - Event hub trigger func in python

查看:124
本文介绍了Azure函数 - python中的事件中心触发器函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在python中创建了一个eventhub触发器azure func,我无法通过以下方式读取事件消息使用以下代码,


导入日志记录

导入azure.functions为func



def main (event:func.EventHubEvent):

    logging.info('Event Hubs触发函数已处理消息:',event.get_body())

    logging.info('  EnqueuedTimeUtc =',event.enqueued_time)

    logging.info('  SequenceNumber =',event.sequence_number)

    logging.info('  Offset =',event.offset)


如何调用具有param的main函数?请帮忙!!


我也尝试创建对象,但由于它是一个抽象类模块,我收到错误,


def main(事件):

解决方案

下面的文档提供了Azure函数EventHub Trigger Python示例,用于读取消息in 


从发件人发送的EventHub 并将输出写入Azure存储。



< a href ="https://github.com/yokawasa/azure-functions-python-samples/tree/master/v1functions/eventhub-trigger-table-out-bindings"> https://github.com/yokawasa/azure -functions-python-samples / tree / master / v1functions / eventhub-trigger-table-out-bindings


希望这对你有帮助。









$


Hi,

I have created a eventhub trigger azure func in python, I am unable to read the event message by using the below code,

import logging
import azure.functions as func

def main(event: func.EventHubEvent):
    logging.info('Event Hubs trigger function processed message: ', event.get_body())
    logging.info('  EnqueuedTimeUtc =', event.enqueued_time)
    logging.info('  SequenceNumber =', event.sequence_number)
    logging.info('  Offset =', event.offset)

how to call the main function which is having the param? Kindly help on this!!

I also tried to create object, but since its a abstract class module, i am getting error,

def main(event):

解决方案

Below documentation provides Azure Functions EventHub Trigger Python Sample that read the message in 

EventHub that sent from a sender and write output to Azure storage.

https://github.com/yokawasa/azure-functions-python-samples/tree/master/v1functions/eventhub-trigger-table-out-bindings

Hope this will help you.







这篇关于Azure函数 - python中的事件中心触发器函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆