twingly / twingly-amqp

:bus: Ruby gem for RabbitMQ subscribing and publishing
0 stars 0 forks source link

AMQP subscription #8

Closed roback closed 8 years ago

roback commented 8 years ago

close #4

Added a class for subscribing to queues. The code is roughly the same as in chapman and zambezi.

Tested it by using rabbitmqadmin:

$ rabbitmqadmin declare exchange name=binlog-test type=topic

$ bundle console
> s = Twingly::AMQP::Subscription.new(queue_name: "testing-twingly-amqp", routing_key: "testing.#", exchange_topic: "binlog-test")
> s.subscribe do |message|
>   puts message
> end
$ rabbitmqadmin publish exchange=binlog-test routing_key="testing.test" payload='{"message": "hello!"}'

Tests for this would be nice, but I don't know how to do. I don't know how you should test Subscription#subscribe since it blocks the starting thread.

roback commented 8 years ago

I'm finished with this one. I'll add tests for this and #ping in another branch instead of doing it here.

walro commented 8 years ago

Ah, forgot to say so, but it looked good to me :)

jage commented 8 years ago

:+1: