-
Notifications
You must be signed in to change notification settings - Fork 0
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(filemanager): move SQS and DLQ to stateful stack #101
Conversation
config/constants.ts
Outdated
@@ -98,6 +97,9 @@ export const getEnvironmentConfig = ( | |||
securityGroupProps: { | |||
...orcaBusStatefulConfig.securityGroupProps, | |||
}, | |||
eventSourceProps: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the event sources will eventually have to be dynamic? As in not requiring a de-deploy when we want to monitor and ingest new buckets... I guess that's a future feature, but just keeping tabs open on the topic as I guess that this will eventually have to go to some Rust AWS SDK lambda instead of CDK? ... thinking out loud, no need to address this in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, could potentially have env variables that contain an SQS url that the Lambda function uses. Although, wouldn't every new bucket need to somehow be registered with the SQS queue, requiring CDK? Not sure how SQS could discover these on its own, unless there's just a blanket "all buckets" EventBridge rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. @reisingerf, what were your thoughts from previous meetings on this? I'm not sure what are the requirements for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that buckets of interest are configured to send events to the EventBus, to make those discoverable.
Marko's statefull stack will contain (and be expanded with) Event Rules that then funnel events from those buckets of interest to the SQS queue.
The stateless FM stack does not need to change at all for this, as it simply consumes events from the SQS.
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so the dev story of adding a new "bucket of interest" is declaring it statically in CDK (on the EventBus construct/stack in this case) or those Event Rules will be lax enough to just process events from a new bucket? Or some other mechanism I'm not understanding? :-S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"adding a new bucket" is simply adding a new Rule to the stateful stack to forward the events to SQS. This should always be possible, even if there is no such bucket (as it's a simple pattern matching on the EventBus side).
How actual events get to the EventBus is a different story and outside the scope of the stack. This would be the responsibility of whoever controls the bucket in question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could be nice to have the ability to add multiple EventBridge rules to the same SQS queue within this PR. Not sure if this is super useful though because multiple buckets can already be defined for the same rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, about that...
I need to brush up on the Rule syntax, but if I understand the code correctly then the rule filters for a known list of buckets and a given prefix, right?
That prefix would have to be the same across all the listed buckets though?
If yes, then I think I'd prefer a rule per bucket / concern... easier to keep track of and maintain independence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's one prefix for all the buckets. I think you're right, it might make more sense to have it defined per bucket.
…e rule for all buckets
…ck directly and use ARNs instead
5f0181e
to
941d086
Compare
/** | ||
* The dead letter queue ARN. | ||
*/ | ||
deadLetterQueueArn: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you want to pass on the DLQ?
…e this is automatically handled by SQS retries
…-sqs # Conflicts: # config/constants.ts # lib/pipeline/orcabus-stateful-pipeline-stack.ts # test/stateful/eventSourceConstruct.test.ts
Updates
|
}); | ||
|
||
test('Test EventSource created props', () => { | ||
new EventSource(stack, 'TestDatabaseConstruct', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess TestDatabaseConstruct
should be updated to TestEventSourceConstruct
...
(also for the following tests)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #86
I think this one I'll merge before #98, so that #98 can implement the
createFilemanager()
function inside the stateless stack.Note that the architecture is slightly different to the diagram. The Lambda function depends on an
IQueue
construct directly, rather than an SQS url, and has the option to send events to the DLQ.So the final diagram could look more like this, where the DLQ receives events from both the SQS queue and the filemanager Lambda function:The diagram is now like the original design.Changes