package Actors

import helper.ActorHelper


/**
 * Name used on the event bus to identify stream like objects.
 */
case class StreamTopic private(value: String)

object StreamTopic
{
  /**
   * Get topic of already validated string path.
   */
  private def forString(path: String): StreamTopic =
    StreamTopic(path.toLowerCase())

  /**
   * Get the topic of a stream.
   */
  def forStream(path: models.StreamUri): Option[StreamTopic] =
    Some(forString("@stream/" +
      path.components()
        .map(ActorHelper.normalizeName(_))
        .mkString("/")))

  def forStream(stream: models.Stream): Option[StreamTopic] =
    forStream(stream.getUri())

  /**
   * Get the topic of a tag.
   */
  def forTag(tag: models.StreamTag): Option[StreamTopic] =
    ActorHelper.normalizeName(tag.value)
      .filterNot(_.isEmpty)
      .map(x => forString("@tag/" + x))
}
package Actors

import helper.ActorHelper


/**
 * Name used on the event bus to identify stream like objects.
 */
case class StreamTopic private(value: String)

object StreamTopic
{
  /**
   * Get the topic of a stream.
   */
  def forStream(path: models.StreamUri): Option[StreamTopic] =
    Some(StreamTopic(
      "@stream/" + path.components()
        .map(ActorHelper.normalizeName(_))
        .mkString("/")))

  def forStream(stream: models.Stream): Option[StreamTopic] =
    forStream(stream.getUri())

  /**
   * Get the topic of a tag.
   */
  def forTag(tag: models.StreamTag): Option[StreamTopic] =
    ActorHelper.normalizeName(tag.value)
      .filterNot(_.isEmpty)
      .map("@tag/" + _)
      .map(StreamTopic(_))
}
--- 
+++ 
@@ -11,11 +11,17 @@
 object StreamTopic
 {
   /**
+   * Get topic of already validated string path.
+   */
+  private def forString(path: String): StreamTopic =
+    StreamTopic(path.toLowerCase())
+
+  /**
    * Get the topic of a stream.
    */
   def forStream(path: models.StreamUri): Option[StreamTopic] =
-    Some(StreamTopic(
-      "@stream/" + path.components()
+    Some(forString("@stream/" +
+      path.components()
         .map(ActorHelper.normalizeName(_))
         .mkString("/")))
 
@@ -28,6 +34,5 @@
   def forTag(tag: models.StreamTag): Option[StreamTopic] =
     ActorHelper.normalizeName(tag.value)
       .filterNot(_.isEmpty)
-      .map("@tag/" + _)
-      .map(StreamTopic(_))
+      .map(x => forString("@tag/" + x))
 }
Make sure topics are case-insensitive.
