I have an Azure Stream Analytics (ASA) job which I'm using to route events from my Iot Hub to some function apps and blob storage. I just recently got the following error at the Input Preview when my Iot Hub is selected in my ASA job:
Encountered error when communicating with EventHub: Exceeded the maximum number of allowed receivers per partition in a consumer group which is 5. List of connected receivers - [List of uids]
I initially thought it was due to having too many outputs in ASA, as I had 6, but I reduced that to 5 and still get the error. Then, after some research it seems that the issue is on the Iot Hub/ Event hubs side with too many receivers trying to access the same consumer group. I am getting that assumption from here:
EventHubReceiverQuotaExceeded Cause: Stream Analytics can't connect to a partition because the maximum number of allowed receivers per partition in a consumer group has been reached. Recommendation: Ensure that other Stream Analytics jobs or Service Bus Explorer are not using the same consumer group.
So I checked my azure resources to make sure, but I don't have any other ASA jobs and don't have any service Bus Explorer resources. I also went in to Iot Hub and created a new consumer group specifically for my ASA job, then changed my ASA job to use this consumer group.
No luck, I'm still getting the error.
Any ideas on what may be causing this?
For reference, here is my ASA job query:
SELECT
*
INTO
storage
FROM
iothub
SELECT
*
INTO
d2cMessages
FROM
iothub
SELECT
*
INTO
storageQueueFunction
FROM
iothub
WHERE
recType LIKE '3'
SELECT
*
INTO
heartbeatD2CFunctionApp
FROM
iothub
WHERE
recType LIKE '51'
SELECT
*
INTO
ackC2D
FROM
iothub
WHERE
recType LIKE '54'
CodePudding user response:
You have multiple queries in your job, they all read from the IoT Hub input. From the docs:
If your streaming query syntax references the same input Event Hub resource multiple times, the job engine can use multiple readers per query from that same consumer group. When there are too many references to the same consumer group, the job can exceed the limit of five and thrown an error.
A simple workaround is create a temporary result set like this:
WITH telemetry AS (
SELECT * FROM iotHub
)
Then you can change your queries to read from telemetry
instead.
SELECT
*
INTO
storageQueueFunction
FROM
telemetry
WHERE
recType LIKE '3'
Another way to solve your problem is to create multiple inputs for your event hub, each with a different consumer group.