Ruby ActiveMQ

ActiveMQ client for Ruby using openwire protocol through activemq-cpp client.

Changelog

0.0.1 – Initial version with support to publish text messages

Installing

You must install the ActiveMQ-cpp 3.2.5 version previously


  gem install activemq

If needed you can pass where is the activemq-cpp, library and includes, example:


  gem install activemq -- --with-activemq-cpp-lib=/opt/activemq-cpp-3.2.5/lib --with-activemq-cpp-include=/opt/activemq-cpp-3.2.5/include/activemq-cpp-3.2.5

Basic Usage

Considering default configuration of ActiveMQ server

Publish Message

  require 'activemq'
  amqcf = ActiveMQ::ConnectionFactory.new
  connection = amqcf.create_connection
  session = connection.create_session
  topic = session.create_topic("topic_name")
  producer = session.create_producer(topic)
  message = session.create_text_message("Text to send")
  producer.send_message(message)
  connection.close

TODO

  • Add Properties to messages
  • Exception listener
  • Consumer by pooling
  • Consumer by stream
  • Work with Bytes and Map messages