Sha256: a5151ed18be9eed8372ce87ce97b8cc669dcce4df6e84eeb7216a612e1a23903
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
require 'commander/import' require_relative 'topic' # :name is optional, otherwise uses the basename of this executable appname = "vespa" program :name, 'JBoss HornetQ RESTful command line' program :version, '0.0.2' program :description, 'Interact with the JBoss HornetQ RESTful API from the command line' command :topic do |c| c.syntax = "#{appname} topic <name>" c.description = 'Enqueue a message on a topic' c.option '--server <servername>', String, 'The name of the server (default:localhost)' c.option '--port <port>', String, 'The HTTP port (default:8080)' c.option '--context <prefix>', String, 'The context path (default:messaging)' c.option '--payload <message>', String, 'Payload for the message (used to ignore stdin)' c.option '--pull', 'Pull the next message' c.option '--push', 'Push a message' c.option '--durable', 'Set durable on pull' c.option '--subscriber <name>', String, 'Set the name of the subscriber (default:bob)' c.action do |args, options| options.default :server => 'localhost', :port => '8180', :context => 'messaging', :subscriber => 'bob', :durable => true raise "You must provide the topic name" if args[0].nil? topic = Topic.new(options.server,options.port,options.context,args[0],options.subscriber) if !(options.payload.nil?) topic.enqueue(options.payload,options.durable) elsif options.push topic.enqueue($stdin.read,options.durable) end if options.pull topic.dequeue(options.durable) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vespa-0.0.3 | lib/cli.rb |
vespa-0.0.2 | lib/cli.rb |