Class EventSourceMapping
Defines a Lambda EventSourceMapping resource.
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.AWS.Lambda.dll
Syntax (csharp)
public class EventSourceMapping : Resource, IEventSourceMapping, IResource, IConstruct, IDependable
Syntax (vb)
Public Class EventSourceMapping
Inherits Resource
Implements IEventSourceMapping, IResource, IConstruct, IDependable
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:
import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
lambda.addEventSource(new SqsEventSource(sqs));
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.AWS.Lambda;
using Amazon.CDK;
IEventSourceDlq eventSourceDlq;
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",
KafkaBootstrapServers = new [] { "kafkaBootstrapServers" },
KafkaTopic = "kafkaTopic",
MaxBatchingWindow = Duration.Minutes(30),
MaxRecordAge = Duration.Minutes(30),
OnFailure = eventSourceDlq,
ParallelizationFactor = 123,
ReportBatchItemFailures = false,
RetryAttempts = 123,
SourceAccessConfigurations = new [] { new SourceAccessConfiguration {
Type = sourceAccessConfigurationType,
Uri = "uri"
} },
StartingPosition = StartingPosition.TRIM_HORIZON,
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
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
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