Project

pheme

0.01
A long-lived project that still receives updates
Ruby AWS SNS publisher + SQS poller & message handler
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

pheme

Github Actions Badge

GitHub Actions Workflow Badge

Ruby SNS publisher + SQS poller & message handler

Installation

Add this line to your application's Gemfile:

gem 'pheme'

And then execute:

$ bundle

Configuration

# Initializer
aws_config = {
  credentials: Aws::Credentials.new('YOUR_ACCESS_KEY_ID', 'YOUR_SECRET_ACCESS_KEY'),
  region: 'us-east-1', # Enter your AWS region here
}
Aws.config.update(aws_config)
AWS_SNS_CLIENT = Aws::SNS::Client.new(aws_config)
AWS_SQS_CLIENT = Aws::SQS::Client.new(aws_config)

Pheme.configure do |config|
  config.sqs_client = AWS_SQS_CLIENT
  config.sns_client = AWS_SNS_CLIENT
  config.logger = Logger.new(STDOUT) # Optionally replace with your app logger, e.g. `Rails.logger`
end

usage

See https://github.com/wealthsimple/pheme/tree/master/spec/support for example implementations of each class.

TODO: write better usage instructions.

Handling SQS messages

Pheme expects that the SQS messages it is handling will have first been published to an SNS topic before being sent to the SQS queue. This means if the service publishing messages is publishing them directly to the SQS queue, that service must nest the message payload underneath a Message property.