spectre-rabbitmq 1.0.0 → 1.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/spectre/rabbitmq.rb +30 -4
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff5d268247815c24c9ef18aa240d48880d939103f18219daedd70fe27babc866
4
- data.tar.gz: 2c41a4cf22e0091c7d15e094c6bd226fa802f879e826fbf0ad675fa806cc0a92
3
+ metadata.gz: 9bffdc19ec3dca4e142983214b94548268bbc0a159588b681bab316f3eb2d8d4
4
+ data.tar.gz: e1169371920f3453a90e18a53fc58e601aa106aa98a54a9549755e3e18ddb4dc
5
5
  SHA512:
6
- metadata.gz: e41362194b709e48652fc34de990258b9019f81b2b69e05c21559fec0998be5c92d6649dd0cfaf1e9f96c8a809f35e940cf1c90b7adb99914a597bc4bbe29c7f
7
- data.tar.gz: c85e00ecf1670ba4dd90079083ba8c4ec3763873a688e4f2b3ad204a577ca76bc0810fcdf6b8f7096d2cce647728498447f605d35ebd4834395d9a97db7fa0ec
6
+ metadata.gz: ad9f37b8a465696219f951d5e310435585678ab326910a4f3406803b548729d76451799e57b7ac8016e27143d1303343bcf8154eb2e4d9c3e15255ceef9bcbef
7
+ data.tar.gz: f56dfb442e93f3b789780067dbe5e2fdf225059b9cd51e70b99c5074328355f56ddfef4bf7a87b7e45d6596f20ed57ad18222054c0a4a9efa2beddb8988c19d9
@@ -6,7 +6,7 @@ require 'bunny'
6
6
 
7
7
  module Spectre
8
8
  module RabbitMQ
9
- class ActionParamsBase
9
+ class ActionParamsBase < Spectre::DslClass
10
10
  attr_reader :config
11
11
 
12
12
  def initialize config, logger
@@ -35,6 +35,10 @@ module Spectre
35
35
  def routing_key name
36
36
  @config['routing_keys'] << name
37
37
  end
38
+
39
+ def no_log!
40
+ @config['no_log'] = true
41
+ end
38
42
  end
39
43
 
40
44
  class ConsumeActionParams < ActionParamsBase
@@ -96,6 +100,7 @@ module Spectre
96
100
  @messages = []
97
101
 
98
102
  @config['ssl'] = false
103
+ @config['port'] = @config['port'] || 5672
99
104
  end
100
105
 
101
106
  def action name
@@ -108,6 +113,10 @@ module Spectre
108
113
  @config['host'] = hostname
109
114
  end
110
115
 
116
+ def port portnum
117
+ @config['port'] = portnum
118
+ end
119
+
111
120
  def use_ssl!
112
121
  @config['ssl'] = true
113
122
  end
@@ -163,7 +172,14 @@ module Spectre
163
172
 
164
173
  while @messages.count < params.config['messages']
165
174
  message = message_queue.pop
166
- @logger.info("get queue=#{queue.name}\ncorrelation_id: #{message.correlation_id}\nreply_to: #{message.reply_to}\n#{message.payload}")
175
+
176
+ payload_message = message.payload
177
+
178
+ if params.config['no_log'] == true
179
+ payload_message = '[...]'
180
+ end
181
+
182
+ @logger.info("get queue=#{queue.name}\ncorrelation_id: #{message.correlation_id}\nreply_to: #{message.reply_to}\n#{payload_message}")
167
183
  @messages << message
168
184
  end
169
185
  end
@@ -195,7 +211,13 @@ module Spectre
195
211
  reply_to: params.config['reply_to']
196
212
  )
197
213
 
198
- @logger.info("publish exchange=#{params.config['exchange']['name']} routing_key=#{routing_key} payload=\"#{params.config['payload']}\"")
214
+ payload_message = params.config['payload']
215
+
216
+ if params.config['no_log'] == true
217
+ payload_message = '[...]'
218
+ end
219
+
220
+ @logger.info("publish exchange=#{params.config['exchange']['name']} routing_key=#{routing_key} payload=\"#{payload_message}\"")
199
221
  end
200
222
 
201
223
  def await!
@@ -207,10 +229,14 @@ module Spectre
207
229
  def connect
208
230
  return unless @conn.nil?
209
231
 
210
- @logger.info("connect #{@config['username']}:*****@#{@config['host']}#{@config['virtual_host']} ssl=#{@config['ssl']}")
232
+ vhost = @config['virtual_host']
233
+ vhost = '/' + vhost unless vhost.start_with? '/'
234
+
235
+ @logger.info("connect #{@config['username']}:*****@#{@config['host']}#{vhost} ssl=#{@config['ssl']}")
211
236
 
212
237
  @conn = Bunny.new(
213
238
  host: @config['host'],
239
+ port: @config['port'],
214
240
  ssl: @config['ssl'],
215
241
  username: @config['username'],
216
242
  password: @config['password'],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectre-rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Neubauer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spectre-core
@@ -53,7 +53,7 @@ metadata:
53
53
  homepage_uri: https://github.com/ionos-spectre/spectre-rabbitmq
54
54
  source_code_uri: https://github.com/ionos-spectre/spectre-rabbitmq
55
55
  changelog_uri: https://github.com/ionos-spectre/spectre-rabbitmq/blob/master/CHANGELOG.md
56
- post_install_message:
56
+ post_install_message:
57
57
  rdoc_options: []
58
58
  require_paths:
59
59
  - lib
@@ -68,8 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubygems_version: 3.3.7
72
- signing_key:
71
+ rubygems_version: 3.3.26
72
+ signing_key:
73
73
  specification_version: 4
74
74
  summary: RabbitMQ module for spectre
75
75
  test_files: []