Closed sliemeobn closed 8 months ago
What's your thoughts @Joannis pass it to the init
or into buildResponder
.
To me the init
is clearer but then we'll require every HBLamba
to implement init(context:)
and store anything they create from it in HBLambda
.
Passing it to buildResponder
doesn't feel right. It is the InitializationContext
after all. But it might make users lives simpler, in that, it is where you build your responder and need references to all the services you are going to use.
Thought from my side: If you want to use shutdown
to tear things down, the initializer will be much nicer, because you can use simple let
fields on the lambda struct.
If you can only set things up in the buildResponder
, it will have to be a var myTing: Thing?
dance.
I agree with the points thus far, I vouch for adding it to init(context:)
Currently, neither the
init
nor thebuildResponder
has access to theLambdaInitializationContext
.If we add it as a parameter to
HBLambda.init
we can use things likelogger
oreventLoop
when setting up other components.