Skip to content

Conversation

@amimimor
Copy link
Contributor

@amimimor amimimor commented Aug 9, 2021

Description

I've added 2 metadata fields which define:

  • the dead-letters queue (DLQ) name (mandatory)
  • and the max number of times a message is not acknowledged before it is moved to DLQ by SQS (optiona)

Once those fields are set the deletion of messages after the messageRetryLimit is not performed and the component assumes that the message is automatically moved by SQS to the defined DLQ.

Additionally, I've added an integration test that runs either with AWS directly or locally using localstack (sns,sqs,sts mockups) and tests 2 scenarios:

  • current default behavior (w/o DLQ)
  • new behavior with DLQ

Issue reference

#1065

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

Amit Mor and others added 28 commits July 23, 2021 17:34
# This is the 1st commit message:

Improve error message in case of missing property (dapr#1012)

Co-authored-by: Artur Souza <[email protected]>
# This is the commit message dapr#2:

Remove vestigial pubsub/nats code (dapr#1024)

The pubsub/nats component was replaced by pubsub/natsstreaming as part
of dapr/dapr#2003, but the corresponding code
in dapr/components-contrib was not removed, so this change removes it.
# This is the commit message dapr#3:

bugfix for sns topic deletion upon termination

# This is the commit message dapr#4:

Revert "bugfix for sns topic deletion upon termination"

This reverts commit bcaa9bb.
@amimimor amimimor requested review from a team as code owners August 9, 2021 18:47
@artursouza
Copy link
Contributor

@halspang Please, check this PR with Matt.

Amit Mor added 3 commits August 10, 2021 14:58
* skip integration test if no AWS related envvars are set (skip in CI)
* parallel testing in unittests
@amimimor
Copy link
Contributor Author

hi @artursouza . My integration tests over AWS are failing with 'missing region' which indicates that other AWS related envvars are indeed present in the build context (somehow)(i've set t.Skip in cases where the credentials related envvars are missing). Am I right? If so, I need another AWS envvar, namely AWS_REGION to be set to a valid value in the test context

@amimimor
Copy link
Contributor Author

hi @artursouza . My integration tests over AWS are failing with 'missing region' which indicates that other AWS related envvars are indeed present in the build context (somehow)(i've set t.Skip in cases where the credentials related envvars are missing). Am I right? If so, I need another AWS envvar, namely AWS_REGION to be set to a valid value in the test context

well, the tests seem to pass ok now (maybe I saw a cached result). thanks anyways and sorry for the bother

messageRetryLimit int64
// if sqsDeadLettersQueueName is set to a value, then the deadLettersMaxReceives defines the number of times a message is received
// before it is moved to the dead-letters queue. This value must be smaller than messageRetryLimit
deadLettersMaxReceives int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be renamed to messageReceiveLimit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. I borrowed it from the AWS official param. but your suggestion makes sense

}

if val, ok := getAliasedProperty([]string{"deadLettersMaxReceives"}, metadata); !ok {
md.deadLettersMaxReceives = md.messageRetryLimit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make Max Receive mandatory? Mixing these can be confusing.

@@ -0,0 +1,310 @@
// ------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these to the e2e folder until we have a standardized way to write integration tests. See this as example: https://github.com/dapr/components-contrib/tree/master/tests/e2e/bindings/zeebe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is WIP and lots of work. So I think I'll open another PR for that. @artursouza wdyt? I've implemented the suggested changes (thanks, good ones!). I'm going to trigger a new build as it seem to glitch. please re-review

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am OK for the E2E test to be in a separate PR. Once we have integration tests, it can land there too.

@artursouza artursouza self-assigned this Aug 12, 2021
Copy link
Contributor

@artursouza artursouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small change. Plus, don't forget to remove the integ_test file.


const (
awsSqsQueueNameKey = "dapr-queue-name"
awsSqsQueueNameKey = "dapr-worker-name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is a breaking change. This component is alpha but I would avoid breaking changes still.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. you're right

@codecov
Copy link

codecov bot commented Aug 14, 2021

Codecov Report

Merging #1066 (e5d5b37) into master (253ef85) will decrease coverage by 0.50%.
The diff coverage is 23.40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1066      +/-   ##
==========================================
- Coverage   34.53%   34.03%   -0.51%     
==========================================
  Files         132      134       +2     
  Lines       10870    11195     +325     
==========================================
+ Hits         3754     3810      +56     
- Misses       6736     6993     +257     
- Partials      380      392      +12     
Impacted Files Coverage Δ
authentication/azure/storage.go 0.00% <0.00%> (ø)
...indings/azure/servicebusqueues/servicebusqueues.go 15.06% <0.00%> (-0.21%) ⬇️
bindings/smtp/smtp.go 53.33% <0.00%> (-1.84%) ⬇️
pubsub/rocketmq/rocketmq.go 0.00% <ø> (ø)
pubsub/rocketmq/settings.go 86.66% <ø> (ø)
state/azure/tablestorage/tablestorage.go 13.20% <0.00%> (ø)
bindings/alicloud/tablestore/tablestore.go 2.54% <2.54%> (ø)
pubsub/aws/snssqs/snssqs.go 26.57% <14.28%> (-2.42%) ⬇️
bindings/aws/ses/ses.go 24.05% <24.05%> (ø)
state/redis/redis.go 42.22% <33.33%> (-0.64%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 796df4d...e5d5b37. Read the comment docs.

@dapr-bot dapr-bot merged commit 284d744 into dapr:master Aug 14, 2021
amimimor pushed a commit to amimimor/components-contrib that referenced this pull request Dec 9, 2021
* bugfix for sns topic deletion upon termination

* Revert "bugfix for sns topic deletion upon termination"

This reverts commit bcaa9bb.

* wip on normalizing queue/topic names

* sanitize queue and topic names

* sanitized names. bugfix for close

* # This is a combination of 4 commits.
# This is the 1st commit message:

Improve error message in case of missing property (dapr#1012)

Co-authored-by: Artur Souza <[email protected]>
# This is the commit message dapr#2:

Remove vestigial pubsub/nats code (dapr#1024)

The pubsub/nats component was replaced by pubsub/natsstreaming as part
of dapr/dapr#2003, but the corresponding code
in dapr/components-contrib was not removed, so this change removes it.
# This is the commit message dapr#3:

bugfix for sns topic deletion upon termination

# This is the commit message dapr#4:

Revert "bugfix for sns topic deletion upon termination"

This reverts commit bcaa9bb.

* removed debug message

* raw string abort

* merge issues solved

* wip

* gofmt+remove regex and use byte iter

* wip. first impl of dead-letters queue config

* wip. refactor and fallback values

* integration test wip

* wip integration test

* wip integration

* wip on testing

* wip

* still buggy but wip!

* bugfix in dlq creation

* working. still bug in subscription clean up

* Update snssqs_integ_test.go

* golangci-lint fixes

* golangci-lint refactoring

* trying to skip running integrations for snssqs

* testing

* skip integration test if no AWS related envvars are set (skip in CI)
* parallel testing in unittests

* code review fixes

* not using implicit maxReceives
* maxReceives renamed
* unittest refactor

* Update snssqs.go

* integ removed, renaming back of const

Co-authored-by: Maarten Mulders <[email protected]>
Co-authored-by: Artur Souza <[email protected]>
Co-authored-by: Dapr Bot <[email protected]>
Signed-off-by: Amit Mor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants