Various common code and utilities.
MIT licensed.
In SBT:
resolvers += "Garden repository" at "https://dl.bintray.com/maciej/maven/"
libraryDependencies += "me.maciejb.garden" %% "garden-MODULE" % GardenVersion
Core utilities
It is often the case that some of your application services will acquire non-memory resources that need to be
shutdown at a certain point of running the application (either at termination or when leaving a scope).
shutdownables
package tries to address this.
It works best with MacWire type modules.
In order to add shutdownables support to your application module mixin DefaultShutdownHandlerModule
into your
modules and add onShutdown
after the wiring.
trait UserModule extends MacWire with DefaultShutdownHandlerModule {
lazy val service : UserService = wire[UserService] onShutdown {
_.shutdownNow()
}
}
If the UserService
implements the Shutdownable
interface you can add withShutdownHandled()
instead of onShutdown
.
If you want to register a Runtime Shutdown hook mixin ShutdownOnJVMTermination
trait as well.
Test utilities
garden-akka
: includesTimeoutExtensions
for Scala Futuresgarden-json4s
: various serialization extensionsgarden-scalatra
: outdatedgarden-spray
:CorsSupport
and jar-or-file resolvergarden-mongodb
: outdated