ScalaConsultants / reactive-rabbit

Reactive Streams driver for AMQP protocol. Powered by RabbitMQ library.
Apache License 2.0
184 stars 40 forks source link

Only first message is sent to rabbit #63

Open argestes opened 7 years ago

argestes commented 7 years ago
  val lolExchange = Exchange("book.lol.lol", Direct, durable = true)
  val lolSubscriber: Subscriber[Message] = connection.publish(lolExchange.name, "")

class MessageBroadcasterActor(sub : Subscriber[Message]) extends Actor {

    import com.google.common.net.MediaType

    implicit def toMsg(rl : RelatedProduct) : Message = {
      new Message(
      body        = rl.productId.toString.getBytes(StandardCharsets.UTF_8),
      contentType = Some(MediaType.PLAIN_TEXT_UTF_8),
      mode = Persistent
      )
   }

   override def receive: Receive = {
     case x : RelatedProduct => {
     sub.onNext(toMsg(x))
     }
   }
 }

I'm using the code above but I can only see the first message on rabbit. Am I doing something wrong or is it a bug?

mkiedys commented 7 years ago

What is sub?

argestes commented 7 years ago

It's a message exchange val lolSubscriber: Subscriber[Message] = connection.publish(lolExchange.name, "")