本文共 1583 字,大约阅读时间需要 5 分钟。
最近在使用Azure Stream Analytics链接到event hub处理其中的数据时,遇到了下面的BadArgument的错误。该错误发生在Sample Data阶段,在此之前Test检测时正常的。难道是数据格式有错误? 配置的event hub读取格式为JSON UTF-8,经过检查可以排除是由于数据格式造成的这个问题。
Error code:BadArgument\nError message: There was an error while reading sample input.Please check if the input source is configured correctly and data is in correctformat
反复尝试后发现,这个问题实际上是由于event hub的Consumer Group的问题。默认情况下, event hub创建了名为$default的 Consumer Group,如果在从event hub读取数据是不指明consumer group,那么$default将被用来读取数据。但是,event hub另有的规定:
The publish/subscribe mechanism of Event Hubs is enabled throughconsumer groups. A consumer group is a view (state, position, or offset) of an entire Event Hub. Consumer groups enable multiple consuming applications to each have a separate view of the event stream, and to read the stream independently at their own pace and with their own offsets.
In a stream processing architecture, each downstream application equates to a consumer group. If you want to write event data to long-term storage, then that storage writer application is a consumer group. Complex event processing can then be performed by another, separate consumer group. You can only access partitions through a consumer group. Each partition can only have one active reader from a given consumer group at a time. There is always a default consumer group in an Event Hub, and you can create up to 20 consumer groups for a Standard tier Event Hub.
转载地址:http://pwgki.baihongyu.com/