Class EventSourceMapping
Defines a Lambda EventSourceMapping resource.
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class EventSourceMapping : Resource, IEventSourceMapping, IResource
Syntax (vb)
Public Class EventSourceMapping
Inherits Resource
Implements IEventSourceMapping, IResource
Remarks
Usually, you won't need to define the mapping yourself. This will usually be done by event sources. For example, to add an SQS event source to a function:
using Amazon.CDK.AWS.SQS;
using Amazon.CDK.AWS.Lambda.EventSources;
Function handler;
Queue queue;
handler.AddEventSource(new SqsEventSource(queue));
The SqsEventSource
class will automatically create the mapping, and will also
modify the Lambda's execution role so it can consume messages from the queue.
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;
IEventSourceDlq eventSourceDlq;
var filters;
Function function_;
SourceAccessConfigurationType sourceAccessConfigurationType;
var eventSourceMapping = new EventSourceMapping(this, "MyEventSourceMapping", new EventSourceMappingProps {
Target = function_,
// the properties below are optional
BatchSize = 123,
BisectBatchOnError = false,
Enabled = false,
EventSourceArn = "eventSourceArn",
Filters = new [] { new Dictionary<string, object> {
{ "filtersKey", filters }
} },
KafkaBootstrapServers = new [] { "kafkaBootstrapServers" },
KafkaConsumerGroupId = "kafkaConsumerGroupId",
KafkaTopic = "kafkaTopic",
MaxBatchingWindow = Duration.Minutes(30),
MaxConcurrency = 123,
MaxRecordAge = Duration.Minutes(30),
OnFailure = eventSourceDlq,
ParallelizationFactor = 123,
ReportBatchItemFailures = false,
RetryAttempts = 123,
SourceAccessConfigurations = new [] { new SourceAccessConfiguration {
Type = sourceAccessConfigurationType,
Uri = "uri"
} },
StartingPosition = StartingPosition.TRIM_HORIZON,
StartingPositionTimestamp = 123,
SupportS3OnFailureDestination = false,
TumblingWindow = Duration.Minutes(30)
});
Synopsis
Constructors
EventSourceMapping(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
EventSourceMapping(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
EventSourceMapping(Construct, String, IEventSourceMappingProps) |
Properties
EventSourceMappingArn | The ARN of the event source mapping (i.e. arn:aws:lambda:region:account-id:event-source-mapping/event-source-mapping-id). |
EventSourceMappingId | The identifier for this EventSourceMapping. |
Methods
FromEventSourceMappingId(Construct, String, String) | Import an event source into this stack from its event source id. |
Constructors
EventSourceMapping(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected EventSourceMapping(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
EventSourceMapping(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected EventSourceMapping(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
EventSourceMapping(Construct, String, IEventSourceMappingProps)
public EventSourceMapping(Construct scope, string id, IEventSourceMappingProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IEventSourceMappingProps
Properties
EventSourceMappingArn
The ARN of the event source mapping (i.e. arn:aws:lambda:region:account-id:event-source-mapping/event-source-mapping-id).
public virtual string EventSourceMappingArn { get; }
Property Value
System.String
EventSourceMappingId
The identifier for this EventSourceMapping.
public virtual string EventSourceMappingId { get; }
Property Value
System.String
Methods
FromEventSourceMappingId(Construct, String, String)
Import an event source into this stack from its event source id.
public static IEventSourceMapping FromEventSourceMappingId(Construct scope, string id, string eventSourceMappingId)
Parameters
- scope Constructs.Construct
- id System.String
- eventSourceMappingId System.String
Returns