matsluni / aws-spi-akka-http

This is an alternative implementation of the new aws java sdk v2 non-blocking async SPI. It provides an alternative to the built-in Netty implementation based on akka-http.
Apache License 2.0
33 stars 15 forks source link

Make actor system re-use simpler #7

Open ennru opened 5 years ago

ennru commented 5 years ago

If an actor system isn't configured via withActorSystem this library creates its own actor system which is the best alternative when used via reflection.

It might be useful to complement the AkkaHttpClient with a builder method that expects an implicit actor system. I can't come up with a good name right now, though.

matsluni commented 3 years ago

@ennru, I just gave this some thoughts. Do you think something like this, would be good, naming and api wise?

def buildWithDefaults(implicit actorSystem: ActorSystem): AkkaHttpClientBuilder =
    AkkaHttpClientBuilder(Some(actorSystem))

def buildWithDefaults(implicit actorSystemProvider: ClassicActorSystemProvider): AkkaHttpClientBuilder =
    AkkaHttpClientBuilder(Some(actorSystemProvider.classicSystem))

def buildWithDefaults(implicit actorSystem: ActorSystem, executionContext: ExecutionContext): AkkaHttpClientBuilder =
    AkkaHttpClientBuilder(Some(actorSystem), Some(executionContext))

Some thoughts, do we need the ClassicActorSystemProvider here as well? Do you think its also good to have a variant with ActorSystem and ExecutionContext?

ennru commented 3 years ago

I think

def buildWithDefaults()(implicit actorSystem: ClassicActorSystemProvider): AkkaHttpClient

would make sense.