# KafkaActionProperty

Send messages to an Amazon Managed Streaming for Apache Kafka (Amazon MSK) or self-managed Apache Kafka cluster.

- Source: Generated at build time
- Type last changed: v2.103.0 · 26 Oct 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iot as iot } from 'aws-cdk-lib';
const kafkaActionProperty: iot.CfnTopicRule.KafkaActionProperty = {
  clientProperties: {
    clientPropertiesKey: 'clientProperties',
  },
  destinationArn: 'destinationArn',
  topic: 'topic',

  // the properties below are optional
  headers: [{
    key: 'key',
    value: 'value',
  }],
  key: 'key',
  partition: 'partition',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_iot as iot

kafka_action_property = iot.CfnTopicRule.KafkaActionProperty(
    client_properties={
        "client_properties_key": "clientProperties"
    },
    destination_arn="destinationArn",
    topic="topic",

    # the properties below are optional
    headers=[iot.CfnTopicRule.KafkaActionHeaderProperty(
        key="key",
        value="value"
    )],
    key="key",
    partition="partition"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.iot.*;

KafkaActionProperty kafkaActionProperty = KafkaActionProperty.builder()
        .clientProperties(Map.of(
                "clientPropertiesKey", "clientProperties"))
        .destinationArn("destinationArn")
        .topic("topic")

        // the properties below are optional
        .headers(List.of(KafkaActionHeaderProperty.builder()
                .key("key")
                .value("value")
                .build()))
        .key("key")
        .partition("partition")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.IoT;

var kafkaActionProperty = new KafkaActionProperty {
    ClientProperties = new Dictionary<string, string> {
        { "clientPropertiesKey", "clientProperties" }
    },
    DestinationArn = "destinationArn",
    Topic = "topic",

    // the properties below are optional
    Headers = new [] { new KafkaActionHeaderProperty {
        Key = "key",
        Value = "value"
    } },
    Key = "key",
    Partition = "partition"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

kafkaActionProperty := &KafkaActionProperty{
	ClientProperties: map[string]*string{
		"clientPropertiesKey": jsii.String("clientProperties"),
	},
	DestinationArn: jsii.String("destinationArn"),
	Topic: jsii.String("topic"),

	// the properties below are optional
	Headers: []interface{}{
		&KafkaActionHeaderProperty{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	Key: jsii.String("key"),
	Partition: jsii.String("partition"),
}
```

## Properties

- `clientProperties`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | { [key: string]: string } (required) — Properties of the Apache Kafka producer client.

- `destinationArn`: string (required) — The ARN of Kafka action's VPC `TopicRuleDestination` .

- `headers`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnTopicRule.KafkaActionHeaderProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iot.CfnTopicRule.KafkaActionHeaderProperty.html)[] — The list of Kafka headers that you specify.

- `key`: string — The Kafka message key.

- `partition`: string — The Kafka message partition.

- `topic`: string (required) — The Kafka topic for messages to be sent to the Kafka broker.
