No commit activity in last 3 years
No release in over 3 years
RabbitMQ messaging for Geoblacklight.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 1.0.1, ~> 1.0
>= 0
~> 3.0
~> 3.5.0

Runtime

 Project Readme

GeoblacklightMessaging

Build Status | Coverage Status | Gem Version

GeoblacklightMessaging is a plugin that enables Geoblacklight applications to synchronize with external services using a RabbitMQ exchange. The plugin subscribes to events on the exchange and updates Geoblacklight records when they're created, updated, or deleted.

Dependencies

Installation

Add this line to your Geoblacklight application's Gemfile:

gem 'geoblacklight_messaging'

And then execute:

$ bundle

Run generator:

$ rails generate geoblacklight_messaging:install

Configure the events settings in config/messaging.yml:

defaults: &defaults
  events:
    server: <%= ENV['RABBIT_SERVER'] || 'amqp://localhost:5672' %>
    exchange:
      geoblacklight: 'gbl_events'

Usage

  1. Start RabbitMQ:

    $ rabbitmq-server
    
  2. Run your geoblacklight application:

    $ rake geoblacklight:server
    
  3. In a separate console, run:

    $ WORKERS=GeoblacklightMessaging::GeoblacklightEventHandler rake sneakers:run
    
  4. If the RabbitMQ Management Plugin is installed, you can inspect the exchange and publish messages manually using the web interface at http://localhost:15672/.

Message Format

Create

  1. The event workers expect a json create message in the following format:

    {
      "id": "princeton-abc123",
      "event": "CREATED",
      "doc": { "layer_slug_s": "princeton-abc123", "dc_title_s": "Cool Map", ... }
    }
  2. id is the record's unique key. layer_slug_s in this case.

  3. doc is the unescaped geoblacklight json document.

Update

  1. Update is similar to create.

    {
      "id": "princeton-abc123",
      "event": "UPDATED",
      "doc": { "layer_slug_s": "princeton-abc123", "dc_title_s": "New Map Name", ... }
    }

Delete

  1. No doc value is needed for delete:

    {
      "id": "princeton-abc123",
      "event": "DELETED"
    }

Thanks

This gem was based on work done by @tpendragon for Plum and Pomegranate.