> **Experimental**
>
> `@aws-cdk/aws-iot-actions-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# IotEventsPutMessageActionProps

Configuration properties of an action for the IoT Events.

Extends: [CommonActionProps](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-iot-actions-alpha.CommonActionProps.html)
Used as props by: [IotEventsPutMessageAction](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-iot-actions-alpha.IotEventsPutMessageAction.html)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/iotevents-put-message-action.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-iot-actions-alpha/lib/iotevents-put-message-action.ts#L12)

## Example

TypeScript:

```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
    }),
  ],
});
```

Python:

```python
import aws_cdk.aws_iotevents_alpha as iotevents
import aws_cdk.aws_iam as iam

# role: iam.IRole

input = iotevents.Input(self, "MyInput",
    attribute_json_paths=["payload.temperature", "payload.transactionId"]
)
topic_rule = iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT * FROM 'device/+/data'"),
    actions=[
        actions.IotEventsPutMessageAction(input,
            batch_mode=True,  # optional property, default is 'false'
            message_id="${payload.transactionId}",  # optional property, default is a new UUID
            role=role
        )
    ]
)
```

Java:

```java
import software.amazon.awscdk.services.iotevents.alpha.*;
import software.amazon.awscdk.services.iam.*;

IRole role;

Input input = Input.Builder.create(this, "MyInput")
        .attributeJsonPaths(List.of("payload.temperature", "payload.transactionId"))
        .build();
TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
        .sql(IotSql.fromStringAsVer20160323("SELECT * FROM 'device/+/data'"))
        .actions(List.of(
            IotEventsPutMessageAction.Builder.create(input)
                    .batchMode(true) // optional property, default is 'false'
                    .messageId("${payload.transactionId}") // optional property, default is a new UUID
                    .role(role)
                    .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
using Amazon.CDK.AWS.IoTEvents.Alpha;
using Amazon.CDK.AWS.IAM;

IRole role;

var input = new Input(this, "MyInput", new InputProps {
    AttributeJsonPaths = new [] { "payload.temperature", "payload.transactionId" }
});
var topicRule = new TopicRule(this, "TopicRule", new TopicRuleProps {
    Sql = IotSql.FromStringAsVer20160323("SELECT * FROM 'device/+/data'"),
    Actions = new [] {
        new IotEventsPutMessageAction(input, new IotEventsPutMessageActionProps {
            BatchMode = true,  // optional property, default is 'false'
            MessageId = "${payload.transactionId}",  // optional property, default is a new UUID
            Role = role
        }) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
import iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha"
import iam "github.com/aws/aws-cdk-go/awscdk"

var role IRole

input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{
	AttributeJsonPaths: []*string{
		jsii.String("payload.temperature"),
		jsii.String("payload.transactionId"),
	},
})
topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
	Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT * FROM 'device/+/data'")),
	Actions: []IAction{
		actions.NewIotEventsPutMessageAction(input, &IotEventsPutMessageActionProps{
			BatchMode: jsii.Boolean(true),
			 // optional property, default is 'false'
			MessageId: jsii.String("${payload.transactionId}"),
			 // optional property, default is a new UUID
			Role: role,
		}),
	},
})
```

## Properties

- `batchMode`: boolean = false — Whether to process the event actions as a batch.

  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.

- `messageId`: 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.

- `role`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The IAM role that allows access to AWS service.

  **Default:** a new role will be created
