busybee 0.2.0 → 0.3.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/CHANGELOG.md +42 -6
- data/README.md +37 -20
- data/docs/client.md +1 -1
- data/docs/configuration.md +158 -3
- data/docs/grpc.md +1 -1
- data/docs/testing.md +28 -23
- data/docs/workers.md +982 -0
- data/exe/busybee +6 -0
- data/lib/busybee/cli.rb +173 -0
- data/lib/busybee/client/job_operations.rb +14 -6
- data/lib/busybee/configure.rb +290 -0
- data/lib/busybee/defaults.rb +7 -1
- data/lib/busybee/error.rb +23 -0
- data/lib/busybee/job.rb +28 -2
- data/lib/busybee/logging.rb +11 -6
- data/lib/busybee/railtie.rb +28 -4
- data/lib/busybee/runner/hybrid.rb +64 -0
- data/lib/busybee/runner/multi.rb +101 -0
- data/lib/busybee/runner/polling.rb +54 -0
- data/lib/busybee/runner/streaming.rb +159 -0
- data/lib/busybee/runner.rb +97 -0
- data/lib/busybee/runtime_config.rb +184 -0
- data/lib/busybee/testing/activated_job.rb +13 -0
- data/lib/busybee/testing/helpers/execution.rb +139 -0
- data/lib/busybee/testing/helpers/support.rb +1 -1
- data/lib/busybee/testing/helpers.rb +4 -2
- data/lib/busybee/testing/matchers/complete_job.rb +55 -0
- data/lib/busybee/testing/matchers/fail_job.rb +75 -0
- data/lib/busybee/testing/matchers/throw_bpmn_error_on.rb +72 -0
- data/lib/busybee/testing.rb +4 -18
- data/lib/busybee/version.rb +1 -1
- data/lib/busybee/worker/configuration.rb +287 -0
- data/lib/busybee/worker/dsl.rb +187 -0
- data/lib/busybee/worker/shutdown.rb +27 -0
- data/lib/busybee/worker.rb +130 -0
- data/lib/busybee.rb +70 -62
- metadata +42 -3
data/lib/busybee.rb
CHANGED
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
require "socket"
|
|
4
4
|
require "busybee/version"
|
|
5
5
|
require "busybee/defaults"
|
|
6
|
+
require "busybee/configure"
|
|
6
7
|
require "busybee/credentials"
|
|
7
8
|
require "busybee/logging"
|
|
8
9
|
require "busybee/serialization"
|
|
9
10
|
require "busybee/job"
|
|
10
11
|
require "busybee/job_stream"
|
|
11
12
|
require "busybee/client"
|
|
13
|
+
require "busybee/worker"
|
|
14
|
+
require "busybee/runtime_config"
|
|
15
|
+
require "busybee/runner"
|
|
16
|
+
require "busybee/cli"
|
|
12
17
|
|
|
13
|
-
# Top-level gem module
|
|
18
|
+
# Top-level gem module. Configuration readers and defaults live here;
|
|
19
|
+
# validated setters live in Busybee::Configure.
|
|
14
20
|
module Busybee
|
|
15
21
|
# Valid credential type identifiers. Update this as new credential classes are added.
|
|
16
22
|
VALID_CREDENTIAL_TYPES = %w[insecure tls oauth camunda_cloud].freeze
|
|
@@ -18,9 +24,12 @@ module Busybee
|
|
|
18
24
|
# Valid log format identifiers.
|
|
19
25
|
VALID_LOG_FORMATS = %w[text json].freeze
|
|
20
26
|
|
|
27
|
+
# Valid worker mode identifiers.
|
|
28
|
+
VALID_WORKER_MODES = %i[polling streaming hybrid].freeze
|
|
29
|
+
|
|
21
30
|
class << self
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
include Configure
|
|
32
|
+
|
|
24
33
|
attr_accessor :logger
|
|
25
34
|
attr_reader :credentials
|
|
26
35
|
|
|
@@ -28,95 +37,94 @@ module Busybee
|
|
|
28
37
|
yield self
|
|
29
38
|
end
|
|
30
39
|
|
|
31
|
-
def
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
end
|
|
40
|
+
def cluster_address
|
|
41
|
+
@cluster_address || ENV.fetch("CLUSTER_ADDRESS", "localhost:26500")
|
|
42
|
+
end
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
if
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
def credential_type
|
|
45
|
+
return @credential_type if instance_variable_defined?(:@credential_type) && !@credential_type.nil?
|
|
46
|
+
|
|
47
|
+
# Env var fallback - goes through setter for validation
|
|
48
|
+
env_value = ENV.fetch("BUSYBEE_CREDENTIAL_TYPE", nil)
|
|
49
|
+
return nil if env_value.nil?
|
|
50
|
+
|
|
51
|
+
self.credential_type = env_value
|
|
52
|
+
@credential_type
|
|
43
53
|
end
|
|
44
54
|
|
|
45
|
-
def
|
|
46
|
-
@
|
|
55
|
+
def default_fail_job_backoff
|
|
56
|
+
@default_fail_job_backoff || Defaults::DEFAULT_FAIL_JOB_BACKOFF_MS
|
|
47
57
|
end
|
|
48
58
|
|
|
49
|
-
def
|
|
50
|
-
@
|
|
59
|
+
def default_max_jobs
|
|
60
|
+
@default_max_jobs || Defaults::DEFAULT_MAX_JOBS
|
|
51
61
|
end
|
|
52
62
|
|
|
53
|
-
def
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
def default_input_required
|
|
64
|
+
@default_input_required.nil? ? Defaults::DEFAULT_INPUT_REQUIRED : @default_input_required
|
|
65
|
+
end
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"busybee-worker"
|
|
67
|
+
def default_job_lock_timeout
|
|
68
|
+
@default_job_lock_timeout || Defaults::DEFAULT_JOB_LOCK_TIMEOUT_MS
|
|
60
69
|
end
|
|
61
70
|
|
|
62
|
-
def
|
|
63
|
-
|
|
71
|
+
def default_job_request_timeout
|
|
72
|
+
@default_job_request_timeout || Defaults::DEFAULT_JOB_REQUEST_TIMEOUT_MS
|
|
73
|
+
end
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
def default_message_ttl
|
|
76
|
+
@default_message_ttl || Defaults::DEFAULT_MESSAGE_TTL_MS
|
|
66
77
|
end
|
|
67
78
|
|
|
68
|
-
def
|
|
69
|
-
@
|
|
79
|
+
def default_output_required
|
|
80
|
+
@default_output_required.nil? ? Defaults::DEFAULT_OUTPUT_REQUIRED : @default_output_required
|
|
70
81
|
end
|
|
71
82
|
|
|
72
|
-
def
|
|
73
|
-
@
|
|
83
|
+
def default_buffer
|
|
84
|
+
@default_buffer.nil? ? Defaults::DEFAULT_STREAMING_BUFFER : @default_buffer
|
|
74
85
|
end
|
|
75
86
|
|
|
76
|
-
def
|
|
77
|
-
@
|
|
87
|
+
def default_buffer_throttle
|
|
88
|
+
@default_buffer_throttle || Defaults::DEFAULT_BUFFER_THROTTLE_MS
|
|
78
89
|
end
|
|
79
90
|
|
|
80
|
-
def
|
|
81
|
-
@
|
|
91
|
+
def default_worker_mode
|
|
92
|
+
@default_worker_mode || Defaults::DEFAULT_WORKER_MODE
|
|
82
93
|
end
|
|
83
94
|
|
|
84
|
-
def
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
def grpc_retry_delay_ms
|
|
96
|
+
@grpc_retry_delay_ms || Defaults::DEFAULT_GRPC_RETRY_DELAY_MS
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def grpc_retry_enabled
|
|
100
|
+
return @grpc_retry_enabled unless @grpc_retry_enabled.nil?
|
|
89
101
|
|
|
90
|
-
|
|
91
|
-
if VALID_CREDENTIAL_TYPES.include?(str_value)
|
|
92
|
-
@credential_type = str_value.to_sym
|
|
93
|
-
else
|
|
94
|
-
Logging.warn("Invalid credential_type: #{str_value.inspect}. Valid types: #{VALID_CREDENTIAL_TYPES.join(', ')}")
|
|
95
|
-
end
|
|
102
|
+
false
|
|
96
103
|
end
|
|
97
104
|
|
|
98
|
-
def
|
|
99
|
-
|
|
105
|
+
def grpc_retry_errors
|
|
106
|
+
@grpc_retry_errors || default_retry_errors
|
|
107
|
+
end
|
|
100
108
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
def log_format
|
|
110
|
+
@log_format || :text
|
|
111
|
+
end
|
|
104
112
|
|
|
105
|
-
|
|
106
|
-
@
|
|
113
|
+
def default_backpressure_delay
|
|
114
|
+
@default_backpressure_delay || Defaults::DEFAULT_BACKPRESSURE_DELAY_MS
|
|
107
115
|
end
|
|
108
116
|
|
|
109
|
-
def
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
113
|
-
end
|
|
117
|
+
def shutdown_on_errors
|
|
118
|
+
@shutdown_on_errors ||= []
|
|
119
|
+
end
|
|
114
120
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
def worker_name
|
|
122
|
+
return @worker_name if @worker_name
|
|
123
|
+
return ENV["BUSYBEE_WORKER_NAME"] if ENV["BUSYBEE_WORKER_NAME"]
|
|
118
124
|
|
|
119
|
-
|
|
125
|
+
Socket.gethostname
|
|
126
|
+
rescue StandardError
|
|
127
|
+
"busybee-worker"
|
|
120
128
|
end
|
|
121
129
|
|
|
122
130
|
private
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: busybee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Rusterholz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -38,6 +38,26 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: concurrent-ruby
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.1.7
|
|
48
|
+
- - "<"
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '2.0'
|
|
51
|
+
type: :runtime
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: 1.1.7
|
|
58
|
+
- - "<"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '2.0'
|
|
41
61
|
- !ruby/object:Gem::Dependency
|
|
42
62
|
name: grpc
|
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,7 +78,8 @@ description: The missing Ruby gem for Camunda 8. Production-ready worker framewo
|
|
|
58
78
|
and CI/CD deployment tooling for BPMNs.
|
|
59
79
|
email:
|
|
60
80
|
- andyrusterholz@gmail.com
|
|
61
|
-
executables:
|
|
81
|
+
executables:
|
|
82
|
+
- busybee
|
|
62
83
|
extensions: []
|
|
63
84
|
extra_rdoc_files: []
|
|
64
85
|
files:
|
|
@@ -70,13 +91,17 @@ files:
|
|
|
70
91
|
- docs/configuration.md
|
|
71
92
|
- docs/grpc.md
|
|
72
93
|
- docs/testing.md
|
|
94
|
+
- docs/workers.md
|
|
95
|
+
- exe/busybee
|
|
73
96
|
- lib/busybee.rb
|
|
97
|
+
- lib/busybee/cli.rb
|
|
74
98
|
- lib/busybee/client.rb
|
|
75
99
|
- lib/busybee/client/error_handling.rb
|
|
76
100
|
- lib/busybee/client/job_operations.rb
|
|
77
101
|
- lib/busybee/client/message_operations.rb
|
|
78
102
|
- lib/busybee/client/process_operations.rb
|
|
79
103
|
- lib/busybee/client/variable_operations.rb
|
|
104
|
+
- lib/busybee/configure.rb
|
|
80
105
|
- lib/busybee/credentials.rb
|
|
81
106
|
- lib/busybee/credentials/camunda_cloud.rb
|
|
82
107
|
- lib/busybee/credentials/insecure.rb
|
|
@@ -92,16 +117,30 @@ files:
|
|
|
92
117
|
- lib/busybee/job_stream.rb
|
|
93
118
|
- lib/busybee/logging.rb
|
|
94
119
|
- lib/busybee/railtie.rb
|
|
120
|
+
- lib/busybee/runner.rb
|
|
121
|
+
- lib/busybee/runner/hybrid.rb
|
|
122
|
+
- lib/busybee/runner/multi.rb
|
|
123
|
+
- lib/busybee/runner/polling.rb
|
|
124
|
+
- lib/busybee/runner/streaming.rb
|
|
125
|
+
- lib/busybee/runtime_config.rb
|
|
95
126
|
- lib/busybee/serialization.rb
|
|
96
127
|
- lib/busybee/testing.rb
|
|
97
128
|
- lib/busybee/testing/activated_job.rb
|
|
98
129
|
- lib/busybee/testing/helpers.rb
|
|
130
|
+
- lib/busybee/testing/helpers/execution.rb
|
|
99
131
|
- lib/busybee/testing/helpers/support.rb
|
|
132
|
+
- lib/busybee/testing/matchers/complete_job.rb
|
|
133
|
+
- lib/busybee/testing/matchers/fail_job.rb
|
|
100
134
|
- lib/busybee/testing/matchers/have_activated.rb
|
|
101
135
|
- lib/busybee/testing/matchers/have_available_jobs.rb
|
|
102
136
|
- lib/busybee/testing/matchers/have_received_headers.rb
|
|
103
137
|
- lib/busybee/testing/matchers/have_received_variables.rb
|
|
138
|
+
- lib/busybee/testing/matchers/throw_bpmn_error_on.rb
|
|
104
139
|
- lib/busybee/version.rb
|
|
140
|
+
- lib/busybee/worker.rb
|
|
141
|
+
- lib/busybee/worker/configuration.rb
|
|
142
|
+
- lib/busybee/worker/dsl.rb
|
|
143
|
+
- lib/busybee/worker/shutdown.rb
|
|
105
144
|
homepage: https://github.com/rusterholz/busybee
|
|
106
145
|
licenses:
|
|
107
146
|
- MIT
|