- Newest
- Most votes
- Most comments
The issue you're experiencing with your IoT Events Detector Model not receiving or logging all events, leading to premature timer expiry, could be related to a few factors:
-
Batch Evaluation: Your detector model is using the "BATCH" evaluation method. This means that IoT Events processes inputs in batches, which can introduce some delay in processing and may not immediately reflect all incoming events. This could explain why you're seeing events approximately once per minute instead of for every message.
-
Input Throttling: While you've checked the quotas, it's worth noting that IoT Events has a default input throttling limit. If you're sending a high volume of messages, some might be throttled, leading to missed events.
-
Lambda Invocation: Since you're using a Lambda function to put messages into IoT Events, there could be potential issues with Lambda execution, such as timeouts or throttling, which might cause some events to be missed.
-
EventBridge to Lambda latency: The path from EventBridge to Lambda and then to IoT Events introduces additional points where messages could be delayed or lost.
To address these issues, you could try the following:
-
Change the evaluation method to "SERIAL" instead of "BATCH". This processes inputs as they arrive, which might be more suitable for your use case.
-
Increase the timer duration to account for potential delays in message processing.
-
Implement a retry mechanism in your Lambda function for putting messages to IoT Events.
-
Consider sending messages directly to IoT Events from IoT Core using IoT Rules, bypassing EventBridge and Lambda, which could reduce latency and potential points of failure.
-
Implement additional logging in your Lambda function to ensure all messages are being processed and successfully sent to IoT Events.
-
Monitor the IoT Events metrics in CloudWatch to check for throttling or other issues.
If the problem persists after trying these solutions, you may need to contact AWS support for further investigation, as there could be an underlying issue with the IoT Events service itself.
Sources
@aws-cdk/aws-iotevents-actions-alpha module · AWS CDK
Difficulty Implementing Basic Ingest Feature in AWS IoT Core | AWS re:Post
class IotEventsPutMessageAction · AWS CDK
TLDR; when using BatchPutMessageCommand with the IoTEventsDataClient, the messageId must be unique across requests, at least over a time of 1 minute, or the messages will be deduplicated.
The problem was down to the messageId included when putting events to IoT Events. The documentation says that this should be unique within a batch submitted with batch put. As a result, I had used a stringised version of the array index. IoT Events must then batch items together (the detector models evaluation method of BATCH was not a factor here, as I'd already tried SERIAL) over a certain period of time and deduplicated based on the messageId. I have assumed as the rest of the input content would be unique based on the timestamp field, but it appears to deduplicate based on the messageId, over some period of time around 1 minute.
answered 2 years ago
Relevant content
asked 7 years ago
asked 2 years ago
asked 5 years ago
- AWS OFFICIALUpdated 9 months ago
