> **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.
# IotEventsPutMessageAction

The action to put the message from an MQTT message to the IoT Events input.

Implements: [IAction](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-iot-alpha.IAction.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#L40)

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

## Initializer

TypeScript:

```ts
new IotEventsPutMessageAction(input: IInput, props?: IotEventsPutMessageActionProps)
```

Python:

```python
IotEventsPutMessageAction(input: IInput, props: typing.Optional[IotEventsPutMessageActionProps] = None)
```

Java:

```java
new IotEventsPutMessageAction(IInput input, IotEventsPutMessageActionProps props)
```

C# / .NET:

```csharp
new IotEventsPutMessageAction(IInput input, IotEventsPutMessageActionProps? props = null)
```

Golang:

```go
NewIotEventsPutMessageAction(Input IInput, Props IotEventsPutMessageActionProps)
```
