istox 0.1.157.2 → 0.1.157.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/istox/helpers/bunny_boot.rb +1 -0
- data/lib/istox/helpers/logger.rb +6 -0
- data/lib/istox/helpers/messaging.rb +18 -1
- data/lib/istox/helpers/subscriber.rb +7 -6
- data/lib/istox/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b2d25cfc82f9d7bf7bf206709b4e7fce25b0a08969182214b7c21cf2de9b438
|
4
|
+
data.tar.gz: 3da94d7e1152dc79773eadc6f8a9926d475ec68a112aa9ca5b5bc24abfb3daf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1784d28886f44447a7a0655ab744b22c2ecaf8c85a35db582aaaa34d6ca8788a76b312d2297d90079576376a6a59b0412ba58830ceaaae4c37aabf585d6e7cb
|
7
|
+
data.tar.gz: 426c27cf433ebc5f37ce3477dfcc0b90e86bb0a485d674ca1c42ccfae8f1f394f8c084df41b67e61a3453b103aeff36bbdfb2ce34e591df3168eedfd344cb472
|
data/Gemfile.lock
CHANGED
@@ -262,6 +262,7 @@ module Istox
|
|
262
262
|
# For persistence, if exchange is durable, persistent is enabled
|
263
263
|
# For mandatory. if channel is confirmed mode, mandatory is enabled
|
264
264
|
persistent = e.durable?
|
265
|
+
persistent = true if eid(e) == :default
|
265
266
|
mandatory = channel_confirm? e.channel
|
266
267
|
options_dup = options.clone
|
267
268
|
|
data/lib/istox/helpers/logger.rb
CHANGED
@@ -8,6 +8,12 @@ module Istox
|
|
8
8
|
@logger = ::Ougai::Logger.new(STDOUT)
|
9
9
|
@logger.formatter = ::Ougai::Formatters::Readable.new unless ENV.fetch('RAILS_ENV','development') == 'production'|| (defined?(Rails) && Rails.env.production?)
|
10
10
|
|
11
|
+
# adding thread id to logger
|
12
|
+
@logger.before_log = lambda do |data|
|
13
|
+
data[:tracer_id] = Thread.current[:tracer_id]
|
14
|
+
data[:thread_id] = Thread.current.object_id
|
15
|
+
end
|
16
|
+
|
11
17
|
@logger
|
12
18
|
end
|
13
19
|
end
|
@@ -114,12 +114,29 @@ module Istox
|
|
114
114
|
type: 'SEND_EMAIL_TEMPLATE',
|
115
115
|
data: {
|
116
116
|
template_name: template_name,
|
117
|
-
template_data_arr_json: template_data_arr.to_json,
|
117
|
+
template_data_arr_json: process_template_data_arr_for_copy_email(template_data_arr).to_json,
|
118
118
|
attachments_json: attachments&.to_json
|
119
119
|
}
|
120
120
|
}
|
121
121
|
)
|
122
122
|
end
|
123
|
+
|
124
|
+
def process_template_data_arr_for_copy_email(template_data_arr)
|
125
|
+
copy_email_data_arr = []
|
126
|
+
template_data_arr.each do |email_data|
|
127
|
+
next unless email_data[:copy_emails].present?
|
128
|
+
|
129
|
+
email_data[:copy_emails].each do |ce|
|
130
|
+
copy_email_data = email_data.clone
|
131
|
+
copy_email_data[:email] = ce
|
132
|
+
copy_email_data.delete(:copy_emails)
|
133
|
+
copy_email_data_arr << copy_email_data
|
134
|
+
end
|
135
|
+
|
136
|
+
email_data.delete(:copy_emails)
|
137
|
+
end
|
138
|
+
template_data_arr.concat(copy_email_data_arr)
|
139
|
+
end
|
123
140
|
end
|
124
141
|
end
|
125
142
|
end
|
@@ -51,13 +51,17 @@ module Istox
|
|
51
51
|
queue_name = ::Istox::BunnyBoot.queue_name consumer_key
|
52
52
|
queue_durable = ::Istox::BunnyBoot.queue_durable? consumer_key
|
53
53
|
queue_exclusive = ::Istox::BunnyBoot.queue_exclusive consumer_key
|
54
|
+
priority = ::Istox::BunnyBoot.queue_priority consumer_key
|
55
|
+
arguments = {}
|
56
|
+
arguments['x-max-priority'] = priority unless priority.nil?
|
57
|
+
|
54
58
|
begin
|
55
|
-
queue = active_channel.queue(queue_name, durable: queue_durable, exclusive: queue_exclusive || false)
|
59
|
+
queue = active_channel.queue(queue_name, durable: queue_durable, exclusive: queue_exclusive || false, arguments: arguments)
|
56
60
|
rescue Bunny::PreconditionFailed => e
|
57
61
|
# Must re-open a new channel, because now channel is already closed
|
58
62
|
active_channel = ::Istox::BunnyBoot.channel(::Istox::BunnyBoot.connection, pool_size: pool_size, prefetch: prefetch)
|
59
63
|
active_channel.queue_delete(queue_name)
|
60
|
-
queue = active_channel.queue(queue_name, durable: queue_durable)
|
64
|
+
queue = active_channel.queue(queue_name, durable: queue_durable, arguments: arguments)
|
61
65
|
end
|
62
66
|
|
63
67
|
# Declare exchange
|
@@ -105,10 +109,7 @@ module Istox
|
|
105
109
|
end
|
106
110
|
end
|
107
111
|
# Subscribe queue
|
108
|
-
|
109
|
-
arguments = {}
|
110
|
-
arguments['x-max-priority'] = priority unless priority.nil?
|
111
|
-
queue.subscribe manual_ack: manual_ack, arguments: arguments do |delivery_info, metadata, payload|
|
112
|
+
queue.subscribe manual_ack: manual_ack do |delivery_info, metadata, payload|
|
112
113
|
# For retried message, if reaching retry count limit, return ack anyway
|
113
114
|
# If retry limit is -1, no retry limit
|
114
115
|
# TODO: No matter the amount of retry limit, send cloudwatch critical alarm if fails after 3 times of retry
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.157.
|
4
|
+
version: 0.1.157.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -539,7 +539,7 @@ files:
|
|
539
539
|
homepage: http://www.abc.com
|
540
540
|
licenses: []
|
541
541
|
metadata: {}
|
542
|
-
post_install_message:
|
542
|
+
post_install_message:
|
543
543
|
rdoc_options: []
|
544
544
|
require_paths:
|
545
545
|
- lib
|
@@ -554,8 +554,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
554
554
|
- !ruby/object:Gem::Version
|
555
555
|
version: '0'
|
556
556
|
requirements: []
|
557
|
-
|
558
|
-
|
557
|
+
rubyforge_project:
|
558
|
+
rubygems_version: 2.7.10
|
559
|
+
signing_key:
|
559
560
|
specification_version: 4
|
560
561
|
summary: istox backend shared gem
|
561
562
|
test_files: []
|