Skip to content
v2.275.0

GlueSchemaRegistryProps Struct ​

Properties for glue schema registry configuration.

Example ​

ts
import { CfnRegistry } from 'aws-cdk-lib/aws-glue';
import { ManagedKafkaEventSource, GlueSchemaRegistry } from 'aws-cdk-lib/aws-lambda-event-sources';

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

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

// Your Glue Schema Registry
const glueRegistry = new CfnRegistry(this, 'Registry', {
  name: 'schema-registry',
  description: 'Schema registry for event source',
});

declare const myFunction: lambda.Function;
myFunction.addEventSource(new ManagedKafkaEventSource({
  clusterArn,
  topic,
  startingPosition: lambda.StartingPosition.TRIM_HORIZON,
  provisionedPollerConfig: {
    minimumPollers: 1,
    maximumPollers: 3,
  },
  schemaRegistryConfig: new GlueSchemaRegistry({
    schemaRegistry: glueRegistry,
    eventRecordFormat: lambda.EventRecordFormat.JSON,
    schemaValidationConfigs: [{ attribute: lambda.KafkaSchemaValidationAttribute.KEY }],
  }),
}));

Properties ​

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.
schemaRegistryoptionalCfnRegistryschema_registryoptionalCfnRegistryschemaRegistryoptionalCfnRegistrySchemaRegistryoptionalCfnRegistrySchemaRegistryoptionalCfnRegistry= none#
The CfnRegistry reference of your glue schema registry.

If used, schemaRegistryArn will be ignored.

schemaRegistryArnoptionalstringschema_registry_arnoptionalstrschemaRegistryArnoptionalStringSchemaRegistryArnoptionalstringSchemaRegistryArnoptional*string= none#
The Arn of your glue 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.