Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
feat: create a parent broker and impl aws_broker
Browse files Browse the repository at this point in the history
  • Loading branch information
eHattori committed Apr 12, 2022
1 parent 21b9a52 commit 6978417
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/pipefy_message/providers/aws_broker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "aws-sdk-sqs"
require "json"

module PipefyMessage
module Providers
class AwsBroker < Broker
def initialize(queue_url)
@poller = Aws::SQS::QueuePoller.new(queue_url)
@wait_time_seconds = 10
end

def poller()
## Aws poller
@poller.poll(wait_time_seconds: @wait_time_seconds) do |received_message|
payload = JSON.parse(received_message.body)
yield(payload)
end
end
end
end
end
9 changes: 9 additions & 0 deletions lib/pipefy_message/providers/broker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module PipefyMessage
module Providers
class Broker
def poller()
raise NotImplementedError
end
end
end
end

0 comments on commit 6978417

Please sign in to comment.