Isimud: AMQP based Messaging and Event Processing Abstraction Component.

Isimud is a minor god, the messenger of the god Enki in Sumerian mythology. He is readily identifiable by the fact that he possesses two faces looking in opposite directions.

Source: Wikipedia

Isimud is an AMQP message publishing and consumption gem intended for Rails applications. It includes the following components:

Installation

Add this line to your application's Gemfile:

gem 'isimud'

And then execute:

$ bundle

Or install it yourself as:

$ gem install isimud

For Rails applications, use the following generators to create config and initializer files, respectively:

$ rails g isimud:config
$ rails g isimud:initializer

Customize the AMQP broker settings in the config/isimud.yml

Usage

Connecting to an AMQP Server

There are two supported conventions for specifying a RabbitMQ server (broker) in the configuration file:

Using a URL

server: amqp:port//user_name:password@host/vhost

Using Separate Parameters:

server:
    host:  hostname
    port:  15672
    user:  user_name
    pass:  password
    vhost: vhost

Complete list of Bunny options available here

Isimud is designed to work with RabbitMQ. Besides the standard AMQP 0.9.1 protocol, Isimud relies on Publishing Confirms (Acknowledgements), which is a RabbitMQ specific extension to AMQP 0.9.1.

Note that Isimud does not automatically create exchanges. Make sure the exchange has been declared on the message server, or you will get an exception. It is highly recommended to set the /durable/ parameter on the exchange in order to prevent loss of messages due to failures.

Isimud uses Bunny to connect to RabbitMQ.

Message Publication

Isimud publish messages to topic based exchanges. Each message is tagged with a routing key, allowing for multiple audiences to selectively receive messages.

Message Queues, Bindings, and Consumption

Isimud uses named, non-exclusive, durable queues to consume messages, with a configurable pre-fetch amount.

There are two ways that message queues may be declared:

  1. Using EventObserver instances. The EventObserver module allows an implementing class to define queues and bindings for each instance.

  2. The EventListener automatically establishes and manages queues for instances of each implementing class.

  3. Each EventListener process maintains its own exclusive queue to automatically add or cancel consumers for EventObserver instances as they added, modified, or deleted.

  4. Custom standalone queues. You may extend EventListener to declare individual queues not associated with a specific object instance.

The EventListener process will automatically create queues on initial startup if they do not already exist. This allows for cold startup on a new AMQP broker.

Message Delivery Information and Metadata

Each time that a message is retrieved from the queue, the following properties are set in the current thread:

| name | contents | | —- | ——– | | isimud_queue_name | Name of the queue processing the thread | | isimud_delivery_info | Message delivery information (Bunny::DeliveryInfo) | | isimud_properties | Message properties metadata (Bunny::MessageProperties) |

Exception Handling

If an uncaught instance of StandardError is raised during message processing, all exception handlers added to the client are run in the order they were declared (see Client#on_exception). Any exceptions raised by the exception handlers themselves are silently ignored.

You can configure the disposition of the message that triggered the exception using the configuration attribute Isimud.retry_failures as follows:

| Isimud.retry_failures | Behavior | | :——————-: | ——– | | false | Never requeue messages (default) | | true | Always requeue messages | | nil | Conditionally re-queue messages based on exception handler return values |

When conditional re-queueing is enabled, requeue is determined based on the return value of all exception handlers, logically AND-ed. If the result is truthy, the message is re-queued. If the return value of any handler is falsey, the message is not re-queued.

Changes

1.4.4

1.4.3

1.4.2

1.4.1

1.3.9

1.3.8

1.3.7

1.3.6

1.3.5

1.3.4

1.3.3

1.3.1

1.3.0

1.2.1

1.2.0

1.1.0

1.0.2

Breaking Changes:

Other Changes:

0.5.2

0.5.1

0.5.0

0.4.10

0.4.5

0.4.1

0.4.0

0.3.7

0.3.6

0.3.5

0.3.4

0.3.1

0.3.0

0.2.17

0.2.15

0.2.13

0.2.12

0.2.10

0.2.4

0.2.2

0.2.0

0.1.4

0.1.3

0.1.2

0.1.1

0.1.0

Contributing

  1. Fork it ( github.com/KeasInc/isimud/fork )

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create a new Pull Request