Class: RServiceBus2::AppResourceAWSSQS

Inherits:
AppResource show all
Defined in:
lib/rservicebus2/appresource/awssqs.rb

Overview

AppResourceAWSDynamoDb

Instance Attribute Summary

Attributes inherited from AppResource

#connection

Instance Method Summary collapse

Methods inherited from AppResource

#_connect, #begin, #commit, #initialize, #reconnect, #resource, #rollback

Constructor Details

This class inherits a constructor from RServiceBus2::AppResource

Instance Method Details

#connect(uri) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rservicebus2/appresource/awssqs.rb', line 9

def connect(uri)
  queue_name = uri.path.sub('/', '')

  region = uri.host

  sts_client = Aws::STS::Client.new(region: region)
   = sts_client.get_caller_identity.

  queue_url = "https://sqs.#{region}.amazonaws.com/" \
              "#{}/#{queue_name}"
  {
    client: Aws::SQS::Client.new(region: region),
    url: queue_url
  }
end

#finishedObject



25
26
27
# File 'lib/rservicebus2/appresource/awssqs.rb', line 25

def finished
  RServiceBus2.rlog "#{self.class.name}. Finished"
end