in src/experimental/patterns/kinesis-lambda.ts [84:116]
constructor(scope: GuStack, id: string, props: GuKinesisLambdaProps) {
super(scope, id, {
...props,
errorPercentageMonitoring: props.monitoringConfiguration.noMonitoring ? undefined : props.monitoringConfiguration,
});
const { account, region } = scope;
const { existingKinesisStream, kinesisStreamProps } = props;
this.kinesisStream = existingKinesisStream
? Stream.fromStreamArn(
scope,
existingKinesisStream.externalKinesisStreamName,
`arn:aws:kinesis:${region}:${account}:stream/${existingKinesisStream.externalKinesisStreamName}`,
)
: AppIdentity.taggedConstruct(
props,
new GuKinesisStream(scope, "KinesisStream", { encryption: StreamEncryption.MANAGED, ...kinesisStreamProps }),
);
const errorHandlingPropsToAwsProps = toAwsErrorHandlingProps(props.errorHandlingConfiguration);
const eventSourceProps: KinesisEventSourceProps = {
startingPosition: StartingPosition.LATEST,
...props.processingProps,
...errorHandlingPropsToAwsProps,
};
// If we have an alias, use this to ensure that all events are sent to a published Lambda version.
// Otherwise, send all events to the latest unpublished version ($LATEST)
const eventSourceTarget = this.alias ?? this;
eventSourceTarget.addEventSource(new KinesisEventSource(this.kinesisStream, eventSourceProps));
}