Skip to content

ServiceGroup should support dynamically adding Services while its running #185

Closed
@fabianfett

Description

@fabianfett

There are scenarios in which users need a running Service in order to retrieve data. This data shall then be used to spawn another Service.

An example for this could be querying AWS SSM for a secret that is then used inside a Lambda.

I imagine the code to look something like this:

import Soto
import SotoSSM

enum MyLambda {
    static func main() async throws {
        let awsClient = AWSClient()
        let ssmClient = SSMClient(awsClient)

        try await withTaskGroup { taskGroup in
            let serviceGroup = ServiceGroup([awsClient])
            taskGroup.addTask {
                try await serviceGroup.run()
            }

            let mySecret = try await ssmClient.getSecret()

            let runtime = LambdaRuntime { (event: Request, context) in
                // use mySecret
            }

            // add runtime to already running serviceGroup.
            serviceGroup.add(runtime)
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions