Azure Functions Event Hub trigger bindings

前端 未结 2 870
梦谈多话
梦谈多话 2020-12-11 22:54

Just have a couple of questions regarding the usage of Azure Functions with an EventHub in an IoT scenario.

  • EventHub has partitions. Typically messages from a
2条回答
  •  一生所求
    2020-12-11 23:40

    Function Apps are based on WebJobs SDK, which use EventHostProcessor to consume events from Event Hubs. So you can lookup information about EventHostProcessor and it will be applicable to your Function App.

    Particularly, you can find the implementation of IEventProcessor here.

    To your questions:

    1. Not sure what you mean by "one instance". One listener will be created per partition, but they can be both hosted inside a single App Plan Instance if the load is low. On the high level, you should not care much: in Consumption Plan you pay per execution time, no matter how many servers/processes/threads are running. Of course, you should care whether the auto-scaling works good enough for high load, but that needs to be tested anyway.

    2. Functions are stateless in a sense that you can't save anything in-memory between two function executions. You are totally fine to save state in external storage. Function App will use PartitionContext.CheckpointAsync() for checkpointing of the current offset. Azure Storage is used internally; again you can read more about how it works in Event Hubs and EventHostProcessor docs, e.g. here.

提交回复
热议问题