istox 0.1.157.2 → 0.1.157.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6d17e6c4d7ac569a5a12eef087e1ba3a2e4b0ddec42a0eb9514372d0c17f7a0
4
- data.tar.gz: 32efb665603259cb2d60b12f96a89a6c54bc318104040e49f329b80d1187b983
3
+ metadata.gz: 8b2d25cfc82f9d7bf7bf206709b4e7fce25b0a08969182214b7c21cf2de9b438
4
+ data.tar.gz: 3da94d7e1152dc79773eadc6f8a9926d475ec68a112aa9ca5b5bc24abfb3daf9
5
5
  SHA512:
6
- metadata.gz: 25dcfc87da877c162785e600a036bdbaca70c547a9b290eb1a181aec6bbd21c6ba0594425ab718f9fffaf42852901250867628c702671502aed7d3851c0f2dd1
7
- data.tar.gz: 62feb8441876dd9bf5d0ee5b13e5a31c627d7f70dd0e5abc956c8ff7f1e91bbdf0cddea74ff0207b2c18afe81263417a87b19d649fb89b0bb334d487da2b1491
6
+ metadata.gz: e1784d28886f44447a7a0655ab744b22c2ecaf8c85a35db582aaaa34d6ca8788a76b312d2297d90079576376a6a59b0412ba58830ceaaae4c37aabf585d6e7cb
7
+ data.tar.gz: 426c27cf433ebc5f37ce3477dfcc0b90e86bb0a485d674ca1c42ccfae8f1f394f8c084df41b67e61a3453b103aeff36bbdfb2ce34e591df3168eedfd344cb472
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.157)
4
+ istox (0.1.157.5)
5
5
  amazing_print
6
6
  awesome_print
7
7
  aws-sdk-sns (~> 1)
@@ -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
 
@@ -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
- priority = ::Istox::BunnyBoot.queue_priority consumer_key
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
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.157.2'.freeze
2
+ VERSION = '0.1.157.7'.freeze
3
3
  end
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.2
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-08-28 00:00:00.000000000 Z
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
- rubygems_version: 3.0.6
558
- signing_key:
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: []