event_hub_aws 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.test +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +1 -0
- data/lib/event_hub_aws/adapters/aws/message.rb +3 -4
- data/lib/event_hub_aws/adapters/aws.rb +17 -9
- data/lib/event_hub_aws/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d6d8cd6e3a3662021f32454f0187d5ac8f26daa56124945a25bec23a684ee85
|
4
|
+
data.tar.gz: 62c21c366bf10fd64ba662030fc0259f2ee5bb861280c5e99a6cad13dc4fa1b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857b59a72cb7190fcaf925d636567f5aa684bd9a150cc8cc061d7691d16532959c345e7abfe82921c544c8d6fa124020e75ed1fa07f584931a3662c7e80c3237
|
7
|
+
data.tar.gz: d4731533089e45e50c355ee43bba4af36c4138c211939885517fecb53149d78d7a831f25b29f2456b856119947425abc11d877d4cbf116f7a8e00c31f552fb7d
|
data/.env.test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
QUEUE_URL=https://sqs.us-west-2.amazonaws.com/
|
2
|
-
QUEUE_ARN=arn:aws:sqs:us-west-2:
|
3
|
-
EXCHANGE_ARN=arn:aws:sns:us-west-2:
|
4
|
-
ACCOUNT_NUMBER=
|
1
|
+
QUEUE_URL=https://sqs.us-west-2.amazonaws.com/123456789012/market-data-events.fifo
|
2
|
+
QUEUE_ARN=arn:aws:sqs:us-west-2:123456789012:market-data-events.fifo
|
3
|
+
EXCHANGE_ARN=arn:aws:sns:us-west-2:123456789012:event-hub.fifo
|
4
|
+
ACCOUNT_NUMBER=123456789012
|
5
5
|
ACCESS_KEY_ID=123
|
6
6
|
SECRET_ACCESS_KEY=321
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
event_hub_aws (1.
|
4
|
+
event_hub_aws (1.1.0)
|
5
5
|
aws-sdk-sns (~> 1.0)
|
6
6
|
aws-sdk-sqs (~> 1.0)
|
7
7
|
event_hub (~> 1.0)
|
@@ -95,6 +95,7 @@ GEM
|
|
95
95
|
|
96
96
|
PLATFORMS
|
97
97
|
x86_64-darwin-21
|
98
|
+
x86_64-darwin-22
|
98
99
|
x86_64-linux
|
99
100
|
|
100
101
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -28,6 +28,7 @@ development:
|
|
28
28
|
queue_url: https://sqs.us-west-2.amazonaws.com/1234567890/events.fifo
|
29
29
|
queue_arn: arn:aws:sqs:us-west-2:1234567890:events.fifo
|
30
30
|
exchange_arn: arn:aws:sns:us-west-2:1234567890:event-hub.fifo
|
31
|
+
# delete_message_on_failure: true # uncomment if you don't have dead-letter queue and wanna just delete messages on failure
|
31
32
|
subscribe:
|
32
33
|
user_registered:
|
33
34
|
handler: Handlers::UserRegistered
|
@@ -31,10 +31,9 @@ class EventHub
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def reject
|
34
|
-
if @adapter.config[:
|
35
|
-
|
36
|
-
|
37
|
-
ack
|
34
|
+
ack if @adapter.config[:delete_message_on_failure]
|
35
|
+
# other wise it will be returned to the main queue and then after the maxReceiveCount it will be sent to
|
36
|
+
# the DeadLetter queue
|
38
37
|
end
|
39
38
|
|
40
39
|
private
|
@@ -31,15 +31,17 @@ class EventHub
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def publish(event)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
message = {
|
35
|
+
message: event.body,
|
36
|
+
message_attributes: {
|
37
|
+
event: { data_type: 'String', string_value: event.class.event },
|
38
|
+
version: { data_type: 'String', string_value: event.class.version },
|
39
|
+
},
|
40
|
+
}
|
41
|
+
if fifo_exchange?
|
42
|
+
message.merge!(message_group_id: 'message_group_id', message_deduplication_id: SecureRandom.uuid)
|
43
|
+
end
|
44
|
+
topic.publish(message)
|
43
45
|
end
|
44
46
|
|
45
47
|
def setup_bindings
|
@@ -79,6 +81,12 @@ class EventHub
|
|
79
81
|
def sqs
|
80
82
|
@sqs ||= ::Aws::SQS::Client.new(@config[:credentials] || {})
|
81
83
|
end
|
84
|
+
|
85
|
+
def fifo_exchange?
|
86
|
+
return @fifo_exchange if defined?(@fifo_exchange)
|
87
|
+
|
88
|
+
@fifo_exchange = @config[:exchange_arn].end_with?('.fifo')
|
89
|
+
end
|
82
90
|
end
|
83
91
|
end
|
84
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_hub_aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Guban
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sns
|