You need to define two separate inputs in your Stream Analytics job.
Stream Analytics inputs you have to use, are either of type IoT Hub or Event Hub. Both support Event compression, like GZip or Deflate.
If both the two types of messages were not compressed, you could connect the default, built-in endpoint to multiple inputs, each with their own consumer group and filter within the job.
Due to the mixed compressed/not compressed telemetry situation, you have to split your IotHub telemetry before handing it over to the stream analytics job.
This can be done using the IoTHub routing, together with an Eventhub:
- Create an eventhub namespace and one eventhub
- Create an iot hub custom endpoint and connect it to this eventhub
- Disable the fallback route in the IotHub (just to prevent mixing non-filtered messages with the compressed ones)
- Create a route with the default built-in endpoint, listening to compressed messages **)
- Create a route with the evenhub listening to non-compressed messages **)
- In the ASA job create an iothub input for the compressed messages
- In the ASA job create a second Eventhub input for the uncompressed messages
**) You have to use the routing query to split the messages. I recommend using an application property like compressed='gzip' to split the incoming messages over the two routes.
The Message class has a property bag for that. Splitting using a message body value is hard (not possible?) due to the compressed nature of messages (I expect, only the body is compressed).
You could also try to accomplish this with two event hubs instead of one iothub endpoint and one eventhub.
See also this tutorial.
do not forget to mark the right answer
(do not forget to mark the right answer)