-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Add Monix and ZIO bundles, Micrometer and PureConfig interop #30
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a80fd97
feat: Add Monix and ZIO bundles, Micrometer and PureConfig interop
jakubjanecek 2635f81
fix: Compilation errors
jakubjanecek 8e88525
refactor: Small PR improvements
jakubjanecek d99910f
refactor: Reorganize the project to get rid of optional deps
jakubjanecek ab622d4
refactor: Minor PR improvements
jakubjanecek 5d63f01
docs: Add more ScalaDoc
jakubjanecek b4ecaa4
test: Add http4s-micrometer interop tests
jakubjanecek 78daa80
build: Try to fix build on Travis
jakubjanecek 4b79398
build: Try to fix build on Travis
jakubjanecek e26cae5
build: Fix Travis build - file system is case sensitive, mine not
jakubjanecek 75e0550
Revert "build: Try to fix build on Travis"
jakubjanecek d27be46
docs: Add missing docs to Micrometer, module structure and bundles
jakubjanecek db96dc4
refactor: Move implicits to implicits object
jakubjanecek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
bundle-monix-http4s-blaze/src/main/scala/com/avast/sst/bundle/MonixServerApp.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.avast.sst.bundle | ||
|
||
import cats.effect.{ExitCode, Resource} | ||
import monix.eval.{Task, TaskApp} | ||
import org.http4s.server.Server | ||
import org.slf4j.LoggerFactory | ||
|
||
/** Extend this `trait` if you want to implement server application using [[monix.eval.Task]] effect data type. | ||
* | ||
* Implement method `program` with initialization and business logic of your application. It will be automatically run until JVM is shut | ||
* down in which case all the resources are cleaned up because the whole `program` is a [[cats.effect.Resource]]. | ||
*/ | ||
trait MonixServerApp extends TaskApp { | ||
|
||
private val logger = LoggerFactory.getLogger(this.getClass) | ||
|
||
def program: Resource[Task, Server[Task]] | ||
|
||
override def run(args: List[String]): Task[ExitCode] = { | ||
program | ||
.use { server => | ||
for { | ||
_ <- Task.delay(logger.info(s"Server started @ ${server.address.getHostString}:${server.address.getPort}")) | ||
_ <- Task.never[Unit] | ||
} yield server | ||
} | ||
.redeem( | ||
ex => { | ||
logger.error("Server initialization failed!", ex) | ||
ExitCode.Error | ||
}, | ||
_ => ExitCode.Success | ||
) | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
bundle-zio-http4s-blaze/src/main/scala/com/avast/sst/bundle/ZioServerApp.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.avast.sst.bundle | ||
|
||
import cats.effect.Resource | ||
import com.github.ghik.silencer.silent | ||
import org.http4s.server.Server | ||
import org.slf4j.LoggerFactory | ||
import zio.interop.catz._ | ||
import zio.{Task, UIO, ZIO} | ||
|
||
/** Extend this `trait` if you want to implement server application using [[zio.ZIO]] effect data type. | ||
* | ||
* Implement method `program` with initialization and business logic of your application. It will be automatically run until JVM is shut | ||
* down in which case all the resources are cleaned up because the whole `program` is a [[cats.effect.Resource]]. | ||
*/ | ||
trait ZioServerApp extends CatsApp { | ||
|
||
private val logger = LoggerFactory.getLogger(this.getClass) | ||
|
||
def program: Resource[Task, Server[Task]] | ||
|
||
@silent("dead code") | ||
override def run(args: List[String]): ZIO[Environment, Nothing, Int] = { | ||
program | ||
.use { server => | ||
for { | ||
_ <- UIO.effectTotal(logger.info(s"Server started @ ${server.address.getHostString}:${server.address.getPort}")) | ||
_ <- Task.never | ||
} yield server | ||
} | ||
.fold( | ||
ex => { | ||
logger.error("Server initialization failed!", ex) | ||
1 | ||
}, | ||
_ => 0 | ||
) | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.