RenoteDac
This is a set of libraries and dependencies which allow you to quickly spin up a RabbitMQ powered Email/Notification Service as part of a (S)ervice (O)riented (A)rchitechture.
Usage
To implement this gem it is necessary to implement the client-server RenoteDac configuration either manually or by installing the renote_dac_client gem
RenoteDac is the subscriber end of a pub/sub notification service thats been extracted for use as a gem. The publisher app publish messages to a RabbitMQ exchange which then pushes the messages to a queue.
The remote Email/Notification service (consumer) uses a pool of workers to pull messages from the RabbitMQ queue and process them into the consumer service database. From there a worker will pull un-sent messages from the database and push them via the postmarks api in batches for delivery.
The postmark response is recorded on the email error column. Email records are left in database as a log.
Installation
Add this line to your application's Gemfile:
gem 'renote_dac'
And then execute:
$ bundle
Or install it yourself as:
$ gem install renote_dac
to generate an initializer and database.yml file run:
$ rails g renote_dac:install
then bundle again because you have a clean newly generated Gemfile
bundle install
to copy migration into app run:
$ rake renote_dac:install:migrations
run migrations:
rake db:create
rake db:migrate
rake db:seed
Starting Sneakers workers
first run:
export WORKERS=ServiceQueueWorker
then run:
rake sneakers:run
Development
Deploy
run the following rake task to
- increment version
- delete old '.gem' files
- build fresh gem
- commit & push with version message
rake app:renote_dac:deploy
Configure
Postmark
add the 'config' gem to your application. Add the following line to your gemfile
gme 'config'
run rails g config:install
to generate the proper file structure in ./config folder to hold your application settings.
add the following to the production.yml and development.yml files inside the ./config/settings folder
development.yml
postmark:
api_token: 'dev-api-key-here'
production.yml
postmark:
api_token: ENV['POSTMARK_API_TOKEN']
Add your api token to your renote_dac initializer.
c.postmark_api_key = Settings.postmark.api_token
Contributing
Contribution directions go here.
License
The gem is available as open source under the terms of the MIT License.