1
0
Fork 0
Ruby client for the Burlesque message queue
Go to file
Gregory Eremin 0c22f3b09f Highlight ruby code in examples 2014-08-16 16:58:23 +07:00
bin Add cli 2014-08-16 16:36:19 +07:00
lib Use splat operator instead of array-wrapping 2014-08-16 16:55:39 +07:00
.gitignore Initial commit 2014-08-15 19:29:07 +07:00
Gemfile Initial commit 2014-08-15 19:29:07 +07:00
Gemfile.lock Fix gemspec 2014-08-16 15:24:01 +07:00
LICENSE.txt Initial commit 2014-08-15 19:29:07 +07:00
README.md Highlight ruby code in examples 2014-08-16 16:58:23 +07:00
Rakefile Initial commit 2014-08-15 19:29:07 +07:00
burlesque-client.gemspec Add gem summary and description 2014-08-16 16:37:36 +07:00

README.md

Burlesque message queue client

Ruby wrapper over Burlesque message queue API

Installation

gem install burlesque-client

Configuration

Client defaults are the same as Burlesque server defaults. If you're using non-standard settings, you can configure client to use them instead.

Burlesque.configure do |c|
  c.host = '10.10.5.155'
  c.port = 4402
  c.timeout = 30
end

Usage

Publish

require 'burlesque'

client = Burlesque::Client.new
queue = 'urgent'
msg = 'Process this message as soon as possible!'

if client.publish(queue, msg)
  puts 'Message successfully published!'
else
  puts 'Failed to publish message'
end

Subscribe

require 'burlesque'

client = Burlesque::Client.new

res = client.subscribe('urgent', 'someday', 'never')
if res.nil?
  puts 'No messages'
else
  puts "Message from queue #{res[:queue]}:"
  puts res[:message]
end

Status

require 'json'
require 'burlesque'

client = Burlesque::Client.new
puts JSON.pretty_generate(client.status)

Debug

require 'json'
require 'burlesque'

client = Burlesque::Client.new
puts JSON.pretty_generate(client.debug)

CLI

$ bsq --help

Usage:
    Publish:
        $ bsq pub urgent "Process this message as soon as possible!"
        or
        $ cat urgent-183.txt | bsq pub urgent
    Subscribe:
        $ bsq sub urgent > urgent-184.txt
    Status:
        $ bsq status
    Debug:
        $ bsq debug

Options:
    -h, --host [HOST]                Burlesque host
    -p, --port [PORT]                Burlesque port
    -t, --timeout [TIMEOUT]          Subscription timeout
    -v, --version                    Display Burlesque Ruby client version
        --help                       Display this help message

Licence

MIT