SpinGo / op-rabbit

The Opinionated RabbitMQ Library for Scala and Akka
Other
232 stars 73 forks source link

Support for consuming of messages different types #166

Closed navoloch closed 5 years ago

navoloch commented 5 years ago

Would be great to provide support for consuming of different type messages from one queue (Or provide an example in read.me since I could not find it):

 Subscription.run(rabbitControl) {
    import Directives._
    channel() {
      consume(queue("queue")) {
        body(as[TypeA]) { abc => ack }
        body(as[TypeB]) { abc => ack }
      }
    }
  }
timcharper commented 5 years ago

Just consume as byte array and implant your own logic to dispatch the serializer?

Sent from my iPhone

On Mar 4, 2019, at 12:58, Oleksandr Gorbyk notifications@github.com wrote:

Would be great to provide support for consuming of different type messages from one queue (Or provide an example in read.me since I could not find it):

Subscription.run(rabbitControl) { import Directives._ channel() { consume(queue("queue")) { body(as[TypeA]) { abc => ack } body(as[TypeB]) { abc => ack } } } } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

navoloch commented 5 years ago

@timcharper Thanks, for replying. That what I actually did at the end (wrapped handlers for different types into future, combined them with recoverWith and passed it to ack method).

Could it be left as an enhancement? or just closed?

timcharper commented 5 years ago

Let's close it :)