constructor()

in source/lib/msk-consumer.ts [46:69]


    constructor(scope: cdk.Construct, id: string, props: KafkaConsumerProps) {
        super(scope, id);

        if (!cdk.Token.isUnresolved(props.batchSize)) {
            if (props.batchSize < this.MIN_BATCH_SIZE || props.batchSize > this.MAX_BATCH_SIZE) {
                throw new Error(`batchSize must be between ${this.MIN_BATCH_SIZE} and ${this.MAX_BATCH_SIZE} (given ${props.batchSize})`);
            }
        }

        const timeoutSeconds = props.timeout.toSeconds();
        if (timeoutSeconds < this.MIN_TIMEOUT_SECONDS || timeoutSeconds > this.MAX_TIMEOUT_SECONDS) {
            throw new Error(`timeout must be a value between ${this.MIN_TIMEOUT_SECONDS} and ${this.MAX_TIMEOUT_SECONDS} seconds (given ${timeoutSeconds})`);
        }

        this.IsSecretEmpty = new cdk.CfnCondition(this, 'IsSecretEmptyCondition', {
            expression: cdk.Fn.conditionEquals(props.scramSecretArn, '')
        });

        this.IsSecretNotEmpty = new cdk.CfnCondition(this, 'IsSecretNotEmptyCondition', {
            expression: cdk.Fn.conditionNot(this.IsSecretEmpty)
        });

        this.Function = this.createFunction(props);
    }