ruby-amqp / bunny

Bunny is a popular, easy to use, mature Ruby client for RabbitMQ
Other
1.39k stars 303 forks source link

any plans to support the new rabbitMQ stream plugin with RabbitMQ 3.9? #623

Closed alilland closed 2 years ago

alilland commented 2 years ago

It looks like RabbitMQ has released a feature this year allowing users to create streams with RabbitMQ

https://www.rabbitmq.com/stream.html

I was looking to see if I could get it configured in ruby after installing the plugin to RabbitMQ - it runs on port 5552 according to the docs

this was my attempt, but it throws an error

# rake task
namespace :other do
  task :streaming do
    conn = Bunny.new("amqp://#{ENV['RABBITMQ_USER']}:#{ENV['RABBITMQ_PASS']}@#{ENV['RABBITMQ_HOST']}", client_properties: { connection_name: :stream })
    conn.start
    channel = conn.create_channel
    exchange = Bunny::Exchange.new(channel, :stream, 'stream')
  end
end
AMQ::Protocol::EmptyResponseError: Empty response received from the server.
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/amq-protocol-2.3.2/lib/amq/protocol/frame.rb:60:in `decode_header'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/bunny-2.17.0/lib/bunny/transport.rb:262:in `read_next_frame'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/bunny-2.17.0/lib/bunny/session.rb:1181:in `init_connection'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/bunny-2.17.0/lib/bunny/session.rb:324:in `start'
/Users/aronlilland/Documents/dev/controlair/titan-api/tasks/other/streamming.rake:6:in `block (2 levels) in <top (required)>'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/bin/ruby_executable_hooks:22:in `eval'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => other:streaming
(See full trace by running task with --trace)
carlhoerberg commented 2 years ago

You can still use Streams, just not the stream protocol with Bunny, but that's optional. Just set x-queue-type to "stream", see more here: https://www.rabbitmq.com/streams.html

alilland commented 2 years ago

unfortunately it still throws the same error with x-queue-type

 ch = conn.create_channel
stream = ch.queue('stream_test', durable: true, auto_delete: false, arguments: { 'x-queue-type': 'stream', 'x-max-length-bytes': 500_000_000 })
AMQ::Protocol::EmptyResponseError: Empty response received from the server.
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/amq-protocol-2.3.2/lib/amq/protocol/frame.rb:60:in `decode_header'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/bunny-2.17.0/lib/bunny/transport.rb:262:in `read_next_frame'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/bunny-2.17.0/lib/bunny/session.rb:1181:in `init_connection'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/bunny-2.17.0/lib/bunny/session.rb:324:in `start'
/Users/aronlilland/Documents/dev/controlair/titan-api/tasks/other/streaming.rake:6:in `block (2 levels) in <top (required)>'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/bin/ruby_executable_hooks:22:in `eval'
/Users/aronlilland/.rvm/gems/ruby-2.6.5/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => other:streaming
(See full trace by running task with --trace)
carlhoerberg commented 2 years ago

It's because you try to connect to the wrong port, use port 5672, not 5552

michaelklishin commented 2 years ago

No plans. Stream protocol support should be implemented a separate client. You can use basic operations on streams using Bunny but won't get must of the benefits.

For every other language that has a RabbitMQ Stream Protocol client, it was a completely brand new library and not an extension to the existing client.