#!/usr/bin/env jruby require 'rubygems' require 'yaml' require 'hornetq' unless ARGV[0] $stderr.puts < Examples: # start standalone server on port #{HornetQ::DEFAULT_NETTY_PORT} hornetq_server hornetq://0.0.0.0/?data_directory=./data # start backup server hornetq_server hornetq://0.0.0.0:5446/?backup=true\\&data_directory=./data_backup # start live server attached to backup on same server hornetq_server hornetq://0.0.0.0:5445,localhost:5446/?data_directory=./data EOF exit 1 end # Check if the argument is a yaml file or a uri if ARGV[0] =~ /\.ya?ml$/ config = YAML.load_file(ARGV[0]) # Allow sub items (1...ARGV.size).each do |i| config = config[ARGV[i]] || config[ARGV[i].to_sym] end puts "config=#{config.inspect}" server = HornetQ::Server::Factory.create_server(config) else uri = ARGV[0] server = HornetQ::Server::Factory.create_server(uri) end server.enable_shutdown_on_signal server.start