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):
print(event)
e = event()
print('Event Hubs trigger function processed message: ', e.get_body())
And the error is:
main(func.EventHubEvent)
Microsoft.Azure.WebJobs.Script: Traceback (most recent call last): File
"D:\home\site\wwwroot\CDPConversion\run.py",
line 92, in <module> main(func.EventHubEvent) File
"D:\home\site\wwwroot\CDPConversion\run.py", line 85, in main e =
event() TypeError: Can't instantiate abstract class EventHubEvent with
abstract methods enqueued_time, get_body, offset, partition_key, sequence_number
Kindly provide a solution to read the message/events from eventhub.