jetstream_bridge 4.6.0 → 5.0.0
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/README.md +1 -1
- data/docs/GETTING_STARTED.md +1 -1
- data/docs/RESTRICTED_PERMISSIONS.md +1 -1
- data/lib/generators/jetstream_bridge/initializer/templates/jetstream_bridge.rb +3 -1
- data/lib/jetstream_bridge/core/config.rb +17 -1
- data/lib/jetstream_bridge/provisioner.rb +2 -2
- data/lib/jetstream_bridge/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: 57dcefdf122e13d34d7e913de043e5364d96f806f10186fb436006aad766fc06
|
|
4
|
+
data.tar.gz: 0bd04edc07f63b58751485185a1f6fa1d1126d82b820cdb710ff11fcda069011
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '029e51b5542c45f2640626fe87e8c09aee28cd4a2f76b71df227dac3460fe480a3e72bae04ec6a829789b910e1bf36a2728b907a32aeaea726228db3ec057a54'
|
|
7
|
+
data.tar.gz: 70ffe09b2ab397d53179607d708bf8ff6dbf17bb8405836b292098c894ee2d955a4d3e74efdca5502c8bbb7caf7ce8b627768601e1bb0890953ce01c5c3ddbcc
|
data/README.md
CHANGED
data/docs/GETTING_STARTED.md
CHANGED
|
@@ -662,7 +662,7 @@ subscribe: { allow: ["pwas.>"] }
|
|
|
662
662
|
|
|
663
663
|
If you have any influence over NATS permissions, you have two options:
|
|
664
664
|
|
|
665
|
-
### Option 1: Pull Consumers (Default)
|
|
665
|
+
### Option 1: Pull Consumers (Default) - Summary
|
|
666
666
|
|
|
667
667
|
Request minimal JetStream API permissions:
|
|
668
668
|
|
|
@@ -16,7 +16,9 @@ JetstreamBridge.configure do |config|
|
|
|
16
16
|
# Stream name (required) - managed separately from runtime credentials
|
|
17
17
|
config.stream_name = ENV.fetch('JETSTREAM_STREAM_NAME', 'jetstream-bridge-stream')
|
|
18
18
|
|
|
19
|
-
# Application name (used in subject routing)
|
|
19
|
+
# Application name (used in subject routing and consumer naming)
|
|
20
|
+
# IMPORTANT: Do not include environment identifiers (e.g., use "myapp" not "myapp-production")
|
|
21
|
+
# Consumer names are shared across environments for the same application
|
|
20
22
|
config.app_name = ENV.fetch('APP_NAME', Rails.application.class.module_parent_name.underscore)
|
|
21
23
|
|
|
22
24
|
# Destination app for cross-app sync (REQUIRED for publishing/consuming)
|
|
@@ -8,6 +8,10 @@ module JetstreamBridge
|
|
|
8
8
|
# Holds all configuration settings including NATS connection details,
|
|
9
9
|
# application identifiers, reliability features, and consumer tuning.
|
|
10
10
|
#
|
|
11
|
+
# IMPORTANT: app_name should not include environment identifiers
|
|
12
|
+
# (e.g., use "api" not "api-production") as consumer names are
|
|
13
|
+
# shared across environments for the same application.
|
|
14
|
+
#
|
|
11
15
|
# @example Basic configuration
|
|
12
16
|
# JetstreamBridge.configure do |config|
|
|
13
17
|
# config.nats_urls = "nats://localhost:4222"
|
|
@@ -54,7 +58,8 @@ module JetstreamBridge
|
|
|
54
58
|
# JetStream stream name (required)
|
|
55
59
|
# @return [String]
|
|
56
60
|
attr_accessor :stream_name
|
|
57
|
-
# Application name for subject routing
|
|
61
|
+
# Application name for subject routing and consumer naming.
|
|
62
|
+
# Should not include environment identifiers (e.g., use "api" not "api-production").
|
|
58
63
|
# @return [String]
|
|
59
64
|
attr_accessor :app_name
|
|
60
65
|
# Maximum delivery attempts before moving to DLQ
|
|
@@ -193,6 +198,15 @@ module JetstreamBridge
|
|
|
193
198
|
|
|
194
199
|
# Get the durable consumer name for this application.
|
|
195
200
|
#
|
|
201
|
+
# Returns the app_name with "-workers" suffix. Consumer names are
|
|
202
|
+
# shared across environments, so app_name should not include
|
|
203
|
+
# environment identifiers (e.g., use "myapp" not "myapp-production").
|
|
204
|
+
#
|
|
205
|
+
# @return [String] Durable consumer name
|
|
206
|
+
# @example
|
|
207
|
+
# config.app_name = "notifications"
|
|
208
|
+
# config.durable_name # => "notifications-workers"
|
|
209
|
+
#
|
|
196
210
|
def durable_name
|
|
197
211
|
"#{app_name}-workers"
|
|
198
212
|
end
|
|
@@ -280,6 +294,8 @@ module JetstreamBridge
|
|
|
280
294
|
end
|
|
281
295
|
|
|
282
296
|
def validate_consumer_mode!(errors)
|
|
297
|
+
return errors << 'consumer_mode must be :pull or :push' if consumer_mode.nil?
|
|
298
|
+
|
|
283
299
|
errors << 'consumer_mode must be :pull or :push' unless [:pull, :push].include?(consumer_mode.to_sym)
|
|
284
300
|
end
|
|
285
301
|
end
|
|
@@ -25,8 +25,8 @@ module JetstreamBridge
|
|
|
25
25
|
def ensure!(jts: nil, ensure_consumer: true)
|
|
26
26
|
js = jts || Connection.connect!(verify_js: true)
|
|
27
27
|
|
|
28
|
-
ensure_stream!(js)
|
|
29
|
-
ensure_consumer!(js) if ensure_consumer
|
|
28
|
+
ensure_stream!(jts: js)
|
|
29
|
+
ensure_consumer!(jts: js) if ensure_consumer
|
|
30
30
|
|
|
31
31
|
Logging.info(
|
|
32
32
|
"Provisioned stream=#{@config.stream_name} consumer=#{@config.durable_name if ensure_consumer}",
|