Skip to content

Instantly share code, notes, and snippets.

@jchapuis
Created May 10, 2020 19:38
Show Gist options
  • Save jchapuis/62af8d6c35b40371d16d53c993d2b4c3 to your computer and use it in GitHub Desktop.
Save jchapuis/62af8d6c35b40371d16d53c993d2b4c3 to your computer and use it in GitHub Desktop.
Markdium-Orchestrating startup and shutdown in Scala
Service
.withName("topic-dependent")
.withFallibleStarter( () =>
(for {
_ <- EitherT(KafkaAdmin().ensureTopicCreated("foobar-topic"))
_ <- EitherT.right[KafkaAdmin.TopicCreationFailed](consumer("foobar-topic"))
} yield ()).value
)
.build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment