Skip to content

Commit

Permalink
feat: Added dlq option to aws-sqs eventsource spec (argoproj#1403)
Browse files Browse the repository at this point in the history
* feat: Added dlq option to aws-sqs eventsource spec

Signed-off-by: Daniel Soifer <[email protected]>

* codegen

Signed-off-by: Daniel Soifer <[email protected]>
  • Loading branch information
daniel-codefresh authored Nov 2, 2021
1 parent ca59146 commit 19d375b
Show file tree
Hide file tree
Showing 9 changed files with 453 additions and 365 deletions.
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

0 comments on commit 19d375b

Please sign in to comment.