Skip to content
v2.274.0

ConfluentSchemaRegistryProps Struct ​

Properties for confluent schema registry configuration.

Example ​

ts
import { ManagedKafkaEventSource, ConfluentSchemaRegistry } from 'aws-cdk-lib/aws-lambda-event-sources';
import { Secret } from 'aws-cdk-lib/aws-secretsmanager';

// Your MSK cluster arn
declare const clusterArn: string;

// The Kafka topic you want to subscribe to
const topic = 'some-cool-topic';

const secret = new Secret(this, 'Secret', { secretName: 'AmazonMSK_KafkaSecret' });

declare const myFunction: lambda.Function;
myFunction.addEventSource(new ManagedKafkaEventSource({
  clusterArn,
  topic,
  startingPosition: lambda.StartingPosition.TRIM_HORIZON,
  provisionedPollerConfig: {
    minimumPollers: 1,
    maximumPollers: 3,
  },
  schemaRegistryConfig: new ConfluentSchemaRegistry({
    schemaRegistryUri: 'https://example.com',
    eventRecordFormat: lambda.EventRecordFormat.JSON,
    authenticationType: lambda.KafkaSchemaRegistryAccessConfigType.BASIC_AUTH,
    secret: secret,
    schemaValidationConfigs: [{ attribute: lambda.KafkaSchemaValidationAttribute.KEY }],
  }),
}));

Properties ​

The type of authentication for schema registry credentials.
eventRecordFormatEventRecordFormatevent_record_formatEventRecordFormateventRecordFormatEventRecordFormatEventRecordFormatEventRecordFormatEventRecordFormatEventRecordFormat= nonerequired#
The record format that Lambda delivers to your function after schema validation.
notes
  • Choose JSON to have Lambda deliver the record to your function as a standard JSON object.
  • Choose SOURCE to have Lambda deliver the record to your function in its original source format. Lambda removes all schema metadata, such as the schema ID, before sending the record to your function.
schemaRegistryUristringschema_registry_uristrschemaRegistryUriStringSchemaRegistryUristringSchemaRegistryUri*string= nonerequired#
The URI for your schema registry.
schemaValidationConfigsKafkaSchemaValidationConfig[]schema_validation_configstyping.List[KafkaSchemaValidationConfig]schemaValidationConfigsList<KafkaSchemaValidationConfig>SchemaValidationConfigsKafkaSchemaValidationConfig[]SchemaValidationConfigs*[]KafkaSchemaValidationConfig= nonerequired#
An array of schema validation configuration objects, which tell Lambda the message attributes you want to validate and filter using your schema registry.
secretISecretsecretISecretsecretISecretSecretISecretSecretISecret= nonerequired#
The secret with the schema registry credentials.