codacy.events.Topic.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of events-rabbitmq_2.13 Show documentation
Show all versions of events-rabbitmq_2.13 Show documentation
A library to send events on rabbit-mq
The newest version!
package codacy.events
final case class Topic(parts: List[TopicPart]) extends AnyVal {
def routingKey = parts.map(_.value).mkString(".")
}
object Topic {
trait Components[M[_]] extends Any {
def topics: M[Set[Topic]]
}
}
final case class ComponentName(value: String) extends AnyVal
object ComponentName {
trait Components[M[_]] extends Any {
def componentName: M[ComponentName]
}
}
sealed abstract class TopicPart(val value: String)
object TopicPart {
def apply(value: String): TopicPart = Named(value)
def wildcard: TopicPart = `*`
def hashtag: TopicPart = `#`
case object `#` extends TopicPart("#")
case object `*` extends TopicPart("*")
final case class Named(v: String) extends TopicPart(v)
}