rservicebus2 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 977c2ab9f328770086dc29090e1d06def2037e763e872debc8bcbf9c1050e96c
4
- data.tar.gz: 0565acd0857455a423c012e6b9f08dc155018c39adf6387642623684adbaaa07
3
+ metadata.gz: e5cab110a6dd40b7b80824e669ac85709bbec790bc948d5bdcb954a1b29184a5
4
+ data.tar.gz: 1bc1c569d5af1d01e79c69c0aef99781498bdac5aac13671fd4cd47a286aa2b1
5
5
  SHA512:
6
- metadata.gz: 596ef0eaed4a2462e324efcda720784bd96fde172975647bd48854c435b97b139029e8e3b5531451cd7e7df2a5a73d9116aa51c19c9bc10ecb55b0a8e9584436
7
- data.tar.gz: 7fbad671a58644b047341c89f4ab54abf50856a82eadc6bfee121465cea6dbec83f81c59e35f5431c410f2e80ad7aedb9e97537ce35e81172ccf92488720c68b
6
+ metadata.gz: 64d2065fbd9b061cf17eca6f9c8eea5e8aa4663a9e68a27463417d511496d9e329d2d2d227bd7dc0b677f39e1a0f62b56292394f5b22217517f80f097698b2dc
7
+ data.tar.gz: 5637363459b8c27057d5d2cba9bbd99f558a3a25fbf4f0d0e2971d4e249e8ab58001f123fee08e82c4ee116c38d849ae9ecafd5452c4416f319277e2c91bbabb
@@ -1,16 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aws-sdk-dynamodb'
2
4
 
3
5
  module RServiceBus2
4
6
  # AppResourceAWSDynamoDb
5
7
  class AppResourceAWSDynamoDb < AppResource
6
- # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
7
8
  def connect(uri)
8
9
  region = uri.host
9
10
 
10
11
  Aws::DynamoDB::Client.new(region: region)
11
12
  end
12
13
 
13
- def finished
14
- end
14
+ def finished; end
15
15
  end
16
16
  end
@@ -0,0 +1,25 @@
1
+ require 'aws-sdk-sqs'
2
+ require 'aws-sdk-sts'
3
+
4
+ module RServiceBus2
5
+ # AppResourceAWSDynamoDb
6
+ class AppResourceAWSSQS < AppResource
7
+ def connect(uri)
8
+ queue_name = uri.path.sub('/', '')
9
+
10
+ region = uri.host
11
+
12
+ sts_client = Aws::STS::Client.new(region: region)
13
+ caller_identity_account = sts_client.get_caller_identity.account
14
+
15
+ queue_url = "https://sqs.#{region}.amazonaws.com/" \
16
+ "#{caller_identity_account}/#{queue_name}"
17
+ {
18
+ client: Aws::SQS::Client.new(region: region),
19
+ url: queue_url
20
+ }
21
+ end
22
+
23
+ def finished; end
24
+ end
25
+ end
@@ -37,6 +37,9 @@ module RServiceBus2
37
37
  when 'awss3'
38
38
  require 'rservicebus2/appresource/awss3'
39
39
  rm.add k.sub('RSB_', ''), AppResourceAWSS3.new(host, uri)
40
+ when 'awssqs'
41
+ require 'rservicebus2/appresource/awssqs'
42
+ rm.add k.sub('RSB_', ''), AppResourceAWSSQS.new(host, uri)
40
43
  else
41
44
  abort("Scheme, #{uri.scheme}, not recognised when configuring
42
45
  app resource, #{k}=#{v}")
@@ -26,7 +26,6 @@ module RServiceBus2
26
26
  def initialize(bus, name, uri)
27
27
  @bus = bus
28
28
  new_anonymous_class = Class.new(MonitorMessage)
29
- puts "name: #{name}"
30
29
  Object.const_set(name, new_anonymous_class)
31
30
  @msg_type = Object.const_get(name)
32
31
 
@@ -0,0 +1,32 @@
1
+ require 'aws-sdk-sqs'
2
+ require 'aws-sdk-sts'
3
+
4
+ module RServiceBus2
5
+ # Monitor S3 Bucket for objects
6
+ class MonitorAWSSQS < Monitor
7
+ def connect(uri)
8
+ queue_name = uri.path.sub('/', '')
9
+
10
+ region = uri.host
11
+
12
+ sts_client = Aws::STS::Client.new(region: region)
13
+ caller_identity_account = sts_client.get_caller_identity.account
14
+
15
+ @queue_url = "https://sqs.#{region}.amazonaws.com/" +
16
+ "#{caller_identity_account}/#{queue_name}"
17
+ @sqs_client = Aws::SQS::Client.new(region: region)
18
+ end
19
+
20
+ def look
21
+ # TODO make max available as env variable
22
+ response = @sqs_client.receive_message(queue_url: @queue_url, max_number_of_messages: 1)
23
+ response.messages.each do |message|
24
+ send(message.body, URI.parse(CGI.escape(@queue_url)))
25
+ @sqs_client.delete_message({
26
+ queue_url: @queue_url,
27
+ receipt_handle: message.receipt_handle
28
+ })
29
+ end
30
+ end
31
+ end
32
+ end
@@ -51,6 +51,9 @@ module RServiceBus2
51
51
  when 'awss3'
52
52
  require 'rservicebus2/monitor/awss3'
53
53
  monitor = MonitorAWSS3.new(@host, name, uri)
54
+ when 'awssqs'
55
+ require 'rservicebus2/monitor/awssqs'
56
+ monitor = MonitorAWSSQS.new(@host, name, uri)
54
57
  when 'dirnotifier'
55
58
  require 'rservicebus2/monitor/dirnotifier'
56
59
  monitor = MonitorDirNotifier.new(@host, name, uri)
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rservicebus2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-28 00:00:00.000000000 Z
11
+ date: 2021-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: uuidtools
14
+ name: beanstalk-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.0
19
+ version: 1.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.0
26
+ version: 1.1.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: json
28
+ name: fluiddb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.5.1
33
+ version: 0.1.19
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.5.1
40
+ version: 0.1.19
41
41
  - !ruby/object:Gem::Dependency
42
- name: beanstalk-client
42
+ name: json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.1
47
+ version: 2.5.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.1
54
+ version: 2.5.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: fluiddb
56
+ name: parse-cron
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.19
61
+ version: 0.1.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.19
68
+ version: 0.1.4
69
69
  - !ruby/object:Gem::Dependency
70
- name: parse-cron
70
+ name: uuidtools
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.4
75
+ version: 2.2.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.1.4
82
+ version: 2.2.0
83
83
  description: A Ruby interpretation of NServiceBus
84
84
  email: guy@guyirvine.com
85
85
  executables:
@@ -106,6 +106,7 @@ files:
106
106
  - lib/rservicebus2/appresource.rb
107
107
  - lib/rservicebus2/appresource/awsdynamodb.rb
108
108
  - lib/rservicebus2/appresource/awss3.rb
109
+ - lib/rservicebus2/appresource/awssqs.rb
109
110
  - lib/rservicebus2/appresource/dir.rb
110
111
  - lib/rservicebus2/appresource/file.rb
111
112
  - lib/rservicebus2/appresource/fluiddb.rb
@@ -127,6 +128,7 @@ files:
127
128
  - lib/rservicebus2/message/verboseoutput.rb
128
129
  - lib/rservicebus2/monitor.rb
129
130
  - lib/rservicebus2/monitor/awss3.rb
131
+ - lib/rservicebus2/monitor/awssqs.rb
130
132
  - lib/rservicebus2/monitor/dir.rb
131
133
  - lib/rservicebus2/monitor/dirnotifier.rb
132
134
  - lib/rservicebus2/monitor/message.rb