legion-transport 1.4.4 → 1.4.6
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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +18 -8
- data/lib/legion/transport/connection.rb +25 -0
- data/lib/legion/transport/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2020395943d7e4cdb8b830b8d950f09e6278088bf6826169fd4a59a935c36736
|
|
4
|
+
data.tar.gz: b64e42fce261b601b184ff0ec26d381ee18d7530a8c9cba0fcc68eda8f69a15b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae230ce39595ed76fde09debdf05ff6c69a6f7108cf64a6d278dc0e43df343b0ef61fa6fac95cd8af87edd4650061ae07d3ce3e83811ea5ab2a6de5fabfc00a2
|
|
7
|
+
data.tar.gz: 9a1a089306d9495023d5394b5e957673312443424fd4654c324398fbad63383a788ac8f2f221e0d6eefc084aab4b3a416420a982b55ae2cbe8749316c0b9fb33
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Legion::Transport ChangeLog
|
|
2
2
|
|
|
3
|
+
## [1.4.6] - 2026-03-27
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `create_dedicated_session` in lite mode now returns the shared `InProcess::Session` (if open) rather than creating a new one, preventing `Session#close` from inadvertently resetting process-global in-memory queue state
|
|
7
|
+
- README "Full Default Settings" JSON corrected: `port` is now an integer (`5672`) matching the actual integer type in `Settings.connection`
|
|
8
|
+
- README "Dedicated Sessions" section updated to clarify that lite-mode sessions share process-global in-process transport and are not isolated from other sessions
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- `spec/legion/transport/connection_lite_spec.rb` now explicitly requires `legion/transport/in_process` to ensure `InProcess::Session` is always loaded regardless of `LEGION_MODE` env var or spec execution order
|
|
12
|
+
|
|
13
|
+
## [1.4.5] - 2026-03-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- `Connection.create_dedicated_session` class method for creating isolated AMQP connections separate from the main transport session; returns an `InProcess::Session` in lite mode
|
|
17
|
+
|
|
3
18
|
## [1.4.4] - 2026-03-26
|
|
4
19
|
|
|
5
20
|
### Removed
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Legion::Transport is the Ruby gem responsible for connecting LegionIO to its FIFO queue system (RabbitMQ over AMQP 0.9.1). It provides thread-safe connection management, exchange/queue abstractions, message publishing with optional encryption, and consumer wrappers.
|
|
4
4
|
|
|
5
|
-
**Version**: 1.4.
|
|
5
|
+
**Version**: 1.4.6
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -45,6 +45,16 @@ Legion::Transport::Connection.channel # => Bunny::Channel
|
|
|
45
45
|
Legion::Transport::Connection.session # => Bunny::Session
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### Dedicated Sessions
|
|
49
|
+
|
|
50
|
+
`Connection.create_dedicated_session` creates a separate AMQP connection independent of the shared main session. Useful for consumers that need their own connection (e.g., a dedicated log channel or a build pipeline connection). In lite mode it returns the shared `InProcess::Session` (in-process transport is process-global; true session isolation is not available in lite mode).
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
session = Legion::Transport::Connection.create_dedicated_session(name: 'my-log-session')
|
|
54
|
+
channel = session.create_channel
|
|
55
|
+
# use channel independently of the main transport session
|
|
56
|
+
```
|
|
57
|
+
|
|
48
58
|
### Publishing a Message
|
|
49
59
|
|
|
50
60
|
```ruby
|
|
@@ -141,25 +151,25 @@ Configuration is managed through `legion-settings` with environment variable ove
|
|
|
141
151
|
}
|
|
142
152
|
},
|
|
143
153
|
"connection": {
|
|
144
|
-
"read_timeout":
|
|
154
|
+
"read_timeout": 3,
|
|
145
155
|
"heartbeat": 30,
|
|
146
156
|
"automatically_recover": true,
|
|
147
|
-
"continuation_timeout":
|
|
148
|
-
"network_recovery_interval":
|
|
149
|
-
"connection_timeout":
|
|
157
|
+
"continuation_timeout": 8000,
|
|
158
|
+
"network_recovery_interval": 2,
|
|
159
|
+
"connection_timeout": 10,
|
|
150
160
|
"frame_max": 65536,
|
|
151
161
|
"user": "guest",
|
|
152
162
|
"password": "guest",
|
|
153
163
|
"host": "127.0.0.1",
|
|
154
|
-
"port":
|
|
164
|
+
"port": 5672,
|
|
155
165
|
"vhost": "/",
|
|
156
|
-
"recovery_attempts":
|
|
166
|
+
"recovery_attempts": 10,
|
|
157
167
|
"logger_level": "info",
|
|
158
168
|
"connected": false
|
|
159
169
|
},
|
|
160
170
|
"channel": {
|
|
161
171
|
"default_worker_pool_size": 1,
|
|
162
|
-
"session_worker_pool_size":
|
|
172
|
+
"session_worker_pool_size": 16
|
|
163
173
|
}
|
|
164
174
|
}
|
|
165
175
|
```
|
|
@@ -234,6 +234,31 @@ module Legion
|
|
|
234
234
|
nil
|
|
235
235
|
end
|
|
236
236
|
|
|
237
|
+
def create_dedicated_session(name: 'legion-dedicated')
|
|
238
|
+
if lite_mode?
|
|
239
|
+
# In-process transport is process-global; return the shared session so
|
|
240
|
+
# that callers do not inadvertently reset all queues via Session#close.
|
|
241
|
+
# Use an AtomicReference + compare_and_set so concurrent callers cannot
|
|
242
|
+
# each create a separate InProcess::Session (whose #close calls Local.reset!).
|
|
243
|
+
ref = (@session ||= Concurrent::AtomicReference.new(nil))
|
|
244
|
+
|
|
245
|
+
loop do
|
|
246
|
+
shared = ref.value
|
|
247
|
+
return shared if shared&.open?
|
|
248
|
+
|
|
249
|
+
s = Legion::Transport::InProcess::Session.new
|
|
250
|
+
s.start
|
|
251
|
+
# Install this session only if no other thread has won the race.
|
|
252
|
+
return s if ref.compare_and_set(shared, s)
|
|
253
|
+
# Another thread installed a session first; discard this one and retry.
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
sess = create_session_with_failover(connection_name: name)
|
|
258
|
+
sess.start
|
|
259
|
+
sess
|
|
260
|
+
end
|
|
261
|
+
|
|
237
262
|
private
|
|
238
263
|
|
|
239
264
|
def setup_pool(pool_size:, connection_name:)
|