Liam is an integration between your (Ruby on Rails) App and SNS, SQS AWS Services. It allows sending a message to the AWS queue (SQS) and then processing the topic name on other (Ruby on Rails) App. (microservices)
We called it Liam in honor to (Liam Neeson) for so many reasons!
Liam sends an important message to Marko from Tropoja
I DONT KNOW WHO YOU ARE, I DON’T KNOW WHAT YOU WANT, BUT I WILL FIND YOU AND I WILL KILL YOU...
We have a medium post Here on how we improved communication between our (Ruby on Rails) apps and avoided creating new endpoints in our apps. But what happens when the App A needs data from App B and App B is down for a microsecond?
Welcome, Liam!
With Liam we can send a message easily to SQS Service through SNS Service and process the message data through the consumer that Liam has
The first thing:
-
What's SNS Service? Amazon Simple Notification Service (SNS) Documentation
-
What's SQS Service? Amazon Simple Queue Service (SQS) Documentation
Add this line to your application's Gemfile:
gem 'liam', git: 'https://github.com/alexismansilla/liam.git'
$ bundle install
If you want the liam file in your rails app then execute:
$ bundle exec rails install:liam
We're going to create 2 Liam files
- /config/liam.yaml
- /lib/task/liam.rake
- Producer Message
message = { id: self.id, title: self.title, created_at: self.created_at }.to_json
topic_name = 'liam_CreateArticle'
Liam::Producer.message(topic: topic_name, message: message)
- Consumer Message
Liam::Consumer.message
Can you run the test easily executing
bundle exec rspec
if you want to run all test successfully, we need the LocalStack daemon when sending a message
TODO
Bug reports and pull requests are welcome on GitHub at https://github.com/alexismansilla/liam.