Class: AWSCDK::LambdaEventSources::BaseStreamEventSourceProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lambda_event_sources/base_stream_event_source_props.rb

Overview

The set of properties for streaming event sources shared by Dynamo, Kinesis and Kafka.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(starting_position:, batch_size: nil, enabled: nil, max_batching_window: nil, provisioned_poller_config: nil) ⇒ BaseStreamEventSourceProps

Returns a new instance of BaseStreamEventSourceProps.

Parameters:

  • starting_position (AWSCDK::Lambda::StartingPosition)

    Where to begin consuming the stream.

  • batch_size (Numeric, nil) (defaults to: nil)

    The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.

  • enabled (Boolean, nil) (defaults to: nil)

    If the stream event source mapping should be enabled.

  • max_batching_window (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum amount of time to gather records before invoking the function.

  • provisioned_poller_config (AWSCDK::LambdaEventSources::ProvisionedPollerConfig, nil) (defaults to: nil)

    Configuration for provisioned pollers that read from the event source.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 12

def initialize(starting_position:, batch_size: nil, enabled: nil, max_batching_window: nil, provisioned_poller_config: nil)
  @starting_position = starting_position
  Jsii::Type.check_type(@starting_position, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlN0YXJ0aW5nUG9zaXRpb24ifQ==")), "startingPosition")
  @batch_size = batch_size
  Jsii::Type.check_type(@batch_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "batchSize") unless @batch_size.nil?
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil?
  @max_batching_window = max_batching_window
  Jsii::Type.check_type(@max_batching_window, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxBatchingWindow") unless @max_batching_window.nil?
  @provisioned_poller_config = provisioned_poller_config.is_a?(Hash) ? ::AWSCDK::LambdaEventSources::ProvisionedPollerConfig.new(**provisioned_poller_config.transform_keys(&:to_sym)) : provisioned_poller_config
  Jsii::Type.check_type(@provisioned_poller_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhX2V2ZW50X3NvdXJjZXMuUHJvdmlzaW9uZWRQb2xsZXJDb25maWcifQ==")), "provisionedPollerConfig") unless @provisioned_poller_config.nil?
end

Instance Attribute Details

#batch_sizeNumeric? (readonly)

Note:

Default: 100

The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.

Your function receives an event with all the retrieved records.

Valid Range:

  • Minimum value of 1
  • Maximum value of:

    • 1000 for DynamoEventSource
    • 10000 for KinesisEventSource, ManagedKafkaEventSource and SelfManagedKafkaEventSource

Returns:

  • (Numeric, nil)


44
45
46
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 44

def batch_size
  @batch_size
end

#enabledBoolean? (readonly)

Note:

Default: true

If the stream event source mapping should be enabled.

Returns:

  • (Boolean, nil)


49
50
51
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 49

def enabled
  @enabled
end

#max_batching_windowAWSCDK::Duration? (readonly)

Note:

Default: - Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.

The maximum amount of time to gather records before invoking the function.

Maximum of Duration.minutes(5).



57
58
59
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 57

def max_batching_window
  @max_batching_window
end

#provisioned_poller_configAWSCDK::LambdaEventSources::ProvisionedPollerConfig? (readonly)

Note:

Default: - no provisioned pollers

Configuration for provisioned pollers that read from the event source.

When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the source.



66
67
68
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 66

def provisioned_poller_config
  @provisioned_poller_config
end

#starting_positionAWSCDK::Lambda::StartingPosition (readonly)

Where to begin consuming the stream.



28
29
30
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 28

def starting_position
  @starting_position
end

Class Method Details

.jsii_propertiesObject



68
69
70
71
72
73
74
75
76
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 68

def self.jsii_properties
  {
    :starting_position => "startingPosition",
    :batch_size => "batchSize",
    :enabled => "enabled",
    :max_batching_window => "maxBatchingWindow",
    :provisioned_poller_config => "provisionedPollerConfig",
  }
end

Instance Method Details

#to_jsiiObject



78
79
80
81
82
83
84
85
86
87
88
# File 'lambda_event_sources/base_stream_event_source_props.rb', line 78

def to_jsii
  result = {}
  result.merge!({
    "startingPosition" => @starting_position,
    "batchSize" => @batch_size,
    "enabled" => @enabled,
    "maxBatchingWindow" => @max_batching_window,
    "provisionedPollerConfig" => @provisioned_poller_config,
  })
  result.compact
end