istox 0.1.157.3 → 0.1.157.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -114,12 +114,31 @@ 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
+ next unless ce.present?
131
+
132
+ copy_email_data = email_data.clone
133
+ copy_email_data[:email] = ce
134
+ copy_email_data.delete(:copy_emails)
135
+ copy_email_data_arr << copy_email_data
136
+ end
137
+
138
+ email_data.delete(:copy_emails)
139
+ end
140
+ template_data_arr.concat(copy_email_data_arr)
141
+ end
123
142
  end
124
143
  end
125
144
  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.3'.freeze
2
+ VERSION = '0.1.157.8'.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.3
4
+ version: 0.1.157.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-02 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
@@ -554,7 +554,8 @@ 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.8
557
+ rubyforge_project:
558
+ rubygems_version: 2.7.10
558
559
  signing_key:
559
560
  specification_version: 4
560
561
  summary: istox backend shared gem