Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added dlq option to aws-sqs eventsource spec #1403

Merged
merged 2 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api/event-source.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions api/event-source.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,10 @@
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector",
"description": "AccessKey refers K8s secret containing aws access key"
},
"dlq": {
"description": "DLQ specifies if a dead-letter queue is configured for messages that can't be processed successfully. If set to true, messages with invalid payload won't be acknowledged to allow to forward them farther to the dead-letter queue. The default value is false.",
"type": "boolean"
},
"jsonBody": {
"description": "JSONBody specifies that all event body payload coming from this source will be JSON",
"type": "boolean"
Expand Down
4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion eventsources/sources/awssqs/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ func (el *EventListener) processMessage(ctx context.Context, message *sqslib.Mes
if err != nil {
log.Errorw("failed to marshal event data, will process next message...", zap.Error(err))
el.Metrics.EventProcessingFailed(el.GetEventSourceName(), el.GetEventName())
ack()
// Don't ack if a DLQ is configured to allow to forward the message to the DLQ
if !el.SQSEventSource.DLQ {
ack()
}
return
}
if err = dispatch(eventBytes); err != nil {
Expand Down
759 changes: 395 additions & 364 deletions pkg/apis/eventsource/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions pkg/apis/eventsource/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pkg/apis/eventsource/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/eventsource/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,11 @@ type SQSEventSource struct {
// Metadata holds the user defined metadata which will passed along the event payload.
// +optional
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,9,rep,name=metadata"`
// DLQ specifies if a dead-letter queue is configured for messages that can't be processed successfully.
// If set to true, messages with invalid payload won't be acknowledged to allow to forward them farther to the dead-letter queue.
// The default value is false.
// +optional
DLQ bool `json:"dlq,omitempty" protobuf:"varint,10,opt,name=dlq"`
}

// PubSubEventSource refers to event-source for GCP PubSub related events.
Expand Down