Skip to content
v2.274.0

Experimental

@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

IotEventsPutMessageActionProps Struct ​

Configuration properties of an action for the IoT Events.

Example ​

ts
import * as iotevents from '@aws-cdk/aws-iotevents-alpha';
import * as iam from 'aws-cdk-lib/aws-iam';

declare const role: iam.IRole;

const input = new iotevents.Input(this, 'MyInput', {
  attributeJsonPaths: ['payload.temperature', 'payload.transactionId'],
});
const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323(
    "SELECT * FROM 'device/+/data'",
  ),
  actions: [
    new actions.IotEventsPutMessageAction(input, {
      batchMode: true, // optional property, default is 'false'
      messageId: '${payload.transactionId}', // optional property, default is a new UUID
      role: role, // optional property, default is a new UUID
    }),
  ],
});

Properties ​

batchModebooleanbatch_modeboolbatchModeBooleanBatchModeboolBatchMode*bool= false#
Whether to process the event actions as a batch.
notes

When batchMode is true, you can't specify a messageId.

When batchMode is true and the rule SQL statement evaluates to an Array, each Array element is treated as a separate message when Events by calling BatchPutMessage. The resulting array can't have more than 10 messages.

messageIdstringmessage_idstrmessageIdStringMessageIdstringMessageId*string#
The ID of the message.

Default: none -- a new UUID value will be assigned

When batchMode is true, you can't specify a messageId--a new UUID value will be assigned. Assign a value to this property to ensure that only one input (message) with a given messageId will be processed by an AWS IoT Events detector.

roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole#
The IAM role that allows access to AWS service.

Default: a new role will be created