busybee 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c005e2f714f3f1ea1b3eedf3d8e7b6ce72ad88fe27cf2a8e84637ca4fe3de281
4
+ data.tar.gz: cbefb422a412d32143493b8903886e6429f59bd639a3a05de052f89a94be9edb
5
+ SHA512:
6
+ metadata.gz: e812d00b20c0ff7395b72db6225d57a2adcdee6ad9ecf7381215cd5352b5b034458df6bb3728a3cd25429effee83bc1f85c941dc2f4a7937f86cfb3d64f21688
7
+ data.tar.gz: 61a813477c650a801a04d6d5ed50dc2a5bbef5686de5690599943a61898d2b77a3d66c52109c037c4e99fcf0cfb02c2393cb9f369cac9a65d3ef9da20a8d9da2
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-12-29
4
+
5
+ Initial public release with foundational components for testing BPMN workflows.
6
+
7
+ ### Added
8
+
9
+ - **Testing module** (`Busybee::Testing`) - RSpec helpers and matchers for testing BPMN workflows against Zeebe:
10
+ - `deploy_process` - Deploy BPMN files with optional unique IDs for test isolation
11
+ - `with_process_instance` - Create process instances with automatic cleanup
12
+ - `activate_job` / `activate_jobs` - Activate jobs for assertions
13
+ - `publish_message` - Trigger message catch events
14
+ - `set_variables` - Update process variables
15
+ - `assert_process_completed!` - Verify workflow completion
16
+ - `ActivatedJob` fluent API with `expect_variables`, `expect_headers`, `and_complete`, `and_fail`, `and_throw_error_event`
17
+ - RSpec matchers: `have_activated`, `have_received_variables`, `have_received_headers`
18
+
19
+ - **GRPC layer** (`Busybee::GRPC`) - Generated protocol buffer classes from the Zeebe 8.8 proto definition for direct Zeebe API access
20
+
21
+ ## [0.0.1] - 2025-12-03
22
+
23
+ - Initial development, not for release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Andy Rusterholz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # Busybee
2
+
3
+ **A complete Ruby toolkit for workflow-based orchestration with BPMN, running on Camunda Platform.**
4
+
5
+ If you're a Ruby shop that needs workflow orchestration, you've probably noticed the gap: Camunda Platform is powerful, but the Ruby ecosystem support is thin. Busybee fills that gap. One gem, one Camunda Cloud account, and you're ready to start building. And when you're ready to scale further, Busybee is ready to grow with you, with battle-proven patterns for large distributed systems.
6
+
7
+ Busybee provides everything you need to work with Camunda Platform or self-hosted Zeebe from Ruby:
8
+
9
+ - **Worker Pattern Framework** - Define job handlers as classes with a clean DSL. Busybee handles polling, execution, and lifecycle.
10
+ - **Idiomatic Zeebe Client** - Ruby-native interface with keyword arguments, sensible defaults, and proper exception handling.
11
+ - **RSpec Testing Integration** - Deploy BPMNs, activate jobs, and assert on workflow behavior in your test suite.
12
+ - **Deployment Tools** - CI/CD tooling for deploying BPMN files to your clusters.
13
+ - **Low-Level GRPC Access** - Direct access to Zeebe's protocol buffer API when you need it.
14
+
15
+ ## Roadmap & Availability
16
+
17
+ | Version | Features | Status |
18
+ |---------|---------|--------|
19
+ | v0.1 | BPMN Testing Tools, GRPC Layer | Available now! |
20
+ | v0.2 | Client, Rails Integration | January 2026 |
21
+ | v0.3 | Worker Pattern & CLI | Early 2026 |
22
+ | v0.4 | Instrumentation Hooks, Deployment Tools | Planned for Early 2026 |
23
+ | v1.0 | Production Polish | Planned for Mid 2026 |
24
+
25
+ ## Installation
26
+
27
+ Add busybee to your Gemfile:
28
+
29
+ ```ruby
30
+ gem "busybee"
31
+ ```
32
+
33
+ Then run:
34
+
35
+ ```bash
36
+ bundle install
37
+ ```
38
+
39
+ Or install directly:
40
+
41
+ ```bash
42
+ gem install busybee
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ### Worker Pattern Framework (coming in early 2026)
48
+
49
+ Define job handlers as Ruby classes. Busybee manages the process lifecycle, the connection to Camunda Cloud, and requesting jobs from Zeebe. If you've used Racecar to build Kafka handlers, or Sidekiq to build background jobs, this should feel very familiar.
50
+
51
+ > This feature is still being designed. The example shown here is only representative and will change before implementation.
52
+
53
+ ```ruby
54
+ class ProcessOrderWorker < Busybee::Worker
55
+ type "process-order"
56
+
57
+ input :order_id, required: true
58
+ input :customer_email
59
+
60
+ output :confirmation_number
61
+
62
+ def perform
63
+ confirmation = OrderService.process(order_id)
64
+ complete(confirmation_number: confirmation)
65
+ end
66
+ end
67
+ ```
68
+
69
+ Planned capabilities:
70
+
71
+ - Declarative input/output definitions with validation
72
+ - Automatic job activation and completion
73
+ - Configurable timeouts and retry behavior
74
+ - Graceful shutdown on SIGTERM
75
+ - CLI for running workers: `bundle exec busybee work` or similar
76
+
77
+ ### Idiomatic Zeebe Client (coming in January 2026)
78
+
79
+ A Ruby-native client for Zeebe with keyword arguments, sensible defaults, and proper exception handling.
80
+
81
+ > This feature is still being designed. The example shown here is only representative and will change before implementation.
82
+
83
+ ```ruby
84
+ client = Busybee::Client.new
85
+
86
+ # Deploy a workflow
87
+ client.deploy_process("workflows/order-fulfillment.bpmn")
88
+
89
+ # Start a process instance
90
+ instance_key = client.start_process("order-fulfillment",
91
+ vars: { order_id: "123", items: ["widget", "gadget"] }
92
+ )
93
+
94
+ # Publish a message
95
+ client.publish_message("payment-received",
96
+ correlation_key: "order-123",
97
+ vars: { amount: 99.99 }
98
+ )
99
+ ```
100
+
101
+ Planned capabilities:
102
+
103
+ - Connection management with automatic reconnection
104
+ - Multiple credential types (insecure, TLS, OAuth, Camunda Cloud)
105
+ - GRPC error wrapping with preserved cause chains
106
+ - Rails integration via Railtie and `config/busybee.yml`
107
+ - Duration support for timeouts (works with ActiveSupport if present)
108
+
109
+ ### RSpec Testing Integration (available now!)
110
+
111
+ Deploy processes, create instances, activate jobs, and verify workflow behavior against a real Zeebe instance. A full replacement for the [zeebe_bpmn_rspec](https://github.com/ezcater/zeebe_bpmn_rspec) gem.
112
+
113
+ #### Setup
114
+
115
+ ```ruby
116
+ # spec/spec_helper.rb
117
+ require "rspec"
118
+ require "busybee/testing"
119
+
120
+ Busybee::Testing.configure do |config|
121
+ config.address = "localhost:26500" # or use ZEEBE_ADDRESS env var
122
+ end
123
+ ```
124
+
125
+ #### Example
126
+
127
+ ```ruby
128
+ RSpec.describe "Order Fulfillment" do
129
+ let(:process_id) { deploy_process("spec/fixtures/order.bpmn", uniquify: true)[:process_id] }
130
+
131
+ it "processes payment and ships order" do
132
+ with_process_instance(process_id, order_id: "123", total: 99.99) do
133
+ expect(activate_job("process-payment"))
134
+ .to have_activated
135
+ .with_variables(order_id: "123", total: 99.99)
136
+ .and_complete(payment_id: "pay-456")
137
+
138
+ expect(activate_job("prepare-shipment"))
139
+ .to have_activated
140
+ .with_variables(payment_id: "pay-456")
141
+ .and_complete(tracking_number: "TRACK789")
142
+
143
+ assert_process_completed!
144
+ end
145
+ end
146
+ end
147
+ ```
148
+
149
+ #### Helpers and Matchers
150
+
151
+ - `deploy_process(path, uniquify:)` - Deploy BPMN files with optional unique IDs for test isolation
152
+ - `with_process_instance(process_id, variables)` - Create instances with automatic cleanup
153
+ - `activate_job(type)` / `activate_jobs(type, max_jobs:)` - Activate jobs for assertions
154
+ - `publish_message(name, correlation_key:, variables:)` - Trigger message catch events
155
+ - `set_variables(scope_key, variables)` - Update process variables
156
+ - `assert_process_completed!` - Verify workflow reached an end event
157
+ - `have_activated`, `have_received_variables`, `have_received_headers` - RSpec matchers
158
+
159
+ **[Full testing documentation](docs/testing.md)**
160
+
161
+ ### Deployment Tools (coming in early 2026)
162
+
163
+ CI/CD tooling for deploying BPMN processes to your Zeebe clusters. Version tracking, environment-specific deployments, and pre-deployment validation.
164
+
165
+ ### Low-Level GRPC Access (available now!)
166
+
167
+ For edge cases where the higher-level abstractions don't cover what you need, busybee exposes the raw GRPC interface to Zeebe. This is a complete drop-in replacement for the now-discontinued [zeebe-client](https://github.com/zeebe-io/zeebe-client-ruby) gem.
168
+
169
+ ```ruby
170
+ require "busybee/grpc"
171
+
172
+ stub = Busybee::GRPC::Gateway::Stub.new(
173
+ "localhost:26500",
174
+ :this_channel_is_insecure
175
+ )
176
+
177
+ request = Busybee::GRPC::TopologyRequest.new
178
+ response = stub.topology(request)
179
+ puts response.brokers.map(&:host)
180
+ ```
181
+
182
+ Most users won't need this—the Testing module and future Client cover common workflows. See **[GRPC documentation](docs/grpc.md)** for details.
183
+
184
+ ## Ruby Implementation Support
185
+
186
+ Busybee currently only supports MRI (CRuby). JRuby is not supported because it cannot run C extensions (it would require `grpc-java` with a Ruby wrapper). TruffleRuby's C extension support is experimental and the `grpc` gem does not currently build on it.
187
+
188
+ If you successfully run busybee on an alternative Ruby implementation, please open an issue. We'd welcome contributions to expand platform support!
189
+
190
+ ## Development
191
+
192
+ Busybee includes a Docker Compose setup for running Zeebe locally, plus rake tasks for common development workflows.
193
+
194
+ ```bash
195
+ bin/setup # Install dependencies
196
+ rake zeebe:start # Start local Zeebe + ElasticSearch
197
+ rake zeebe:health # Wait for services to be ready
198
+ bundle exec rspec # Run unit tests
199
+ RUN_INTEGRATION_TESTS=1 bundle exec rspec # Run all tests including integration
200
+ ```
201
+
202
+ **[Full development guide](docs/development.md)** — Local environment setup, running tests, regenerating GRPC classes, and release procedures.
203
+
204
+ ## Contributing
205
+
206
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rusterholz/busybee. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rusterholz/busybee/blob/main/CODE_OF_CONDUCT.md).
207
+
208
+ ## License
209
+
210
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
211
+
212
+ ## Code of Conduct
213
+
214
+ Everyone interacting in the Busybee project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rusterholz/busybee/blob/main/CODE_OF_CONDUCT.md).
data/docs/grpc.md ADDED
@@ -0,0 +1,106 @@
1
+ # Low-Level GRPC Access
2
+
3
+ The `Busybee::GRPC` module contains generated protocol buffer classes from the Zeebe proto definition. This is the lowest-level interface to Zeebe available in busybee.
4
+
5
+ ## When to Use This
6
+
7
+ Most users should use the higher-level abstractions:
8
+
9
+ - **Testing workflows?** Use `Busybee::Testing` (available now)
10
+ - **Building applications?** Use `Busybee::Client` (coming in v0.2)
11
+ - **Processing jobs?** Use `Busybee::Worker` (coming in v0.3)
12
+
13
+ The GRPC layer is an escape hatch for edge cases where you need direct access to Zeebe APIs that the higher-level abstractions don't expose. Examples:
14
+
15
+ - Calling RPCs not yet wrapped by the Client (e.g., `MigrateProcessInstance`, `ModifyProcessInstance`)
16
+ - Building custom tooling that needs low-level control
17
+ - Debugging or experimenting with the Zeebe API directly
18
+
19
+ ## Basic Usage
20
+
21
+ ```ruby
22
+ require "busybee/grpc"
23
+
24
+ # Create a stub (connection to Zeebe gateway)
25
+ stub = Busybee::GRPC::Gateway::Stub.new(
26
+ "localhost:26500",
27
+ :this_channel_is_insecure
28
+ )
29
+
30
+ # Check cluster topology
31
+ request = Busybee::GRPC::TopologyRequest.new
32
+ response = stub.topology(request)
33
+
34
+ response.brokers.each do |broker|
35
+ puts "Broker: #{broker.host}:#{broker.port}"
36
+ broker.partitions.each do |partition|
37
+ puts " Partition #{partition.partition_id}: #{partition.role}"
38
+ end
39
+ end
40
+ ```
41
+
42
+ ## Reducing Verbosity
43
+
44
+ If you're making many GRPC calls, you can include the module to use class names directly:
45
+
46
+ ```ruby
47
+ require "busybee/grpc"
48
+ include Busybee::GRPC
49
+
50
+ stub = Gateway::Stub.new("localhost:26500", :this_channel_is_insecure)
51
+
52
+ response = stub.topology(TopologyRequest.new)
53
+
54
+ request = CreateProcessInstanceRequest.new(
55
+ bpmn_process_id: "order-fulfillment",
56
+ variables: { order_id: "123" }.to_json
57
+ )
58
+ instance = stub.create_process_instance(request)
59
+ ```
60
+
61
+ ## Available Classes
62
+
63
+ The GRPC module exposes:
64
+
65
+ - `Busybee::GRPC::Gateway::Stub` - The gRPC client stub for making calls
66
+ - Request/response classes for each RPC (e.g., `TopologyRequest`, `DeployResourceRequest`, `CreateProcessInstanceRequest`)
67
+ - Enum types and nested message types from the Zeebe proto
68
+
69
+ ## Available RPCs
70
+
71
+ The Gateway service includes these RPCs:
72
+
73
+ | RPC | Description |
74
+ |-----|-------------|
75
+ | `Topology` | Get cluster topology (brokers, partitions) |
76
+ | `DeployResource` | Deploy BPMN processes and other resources |
77
+ | `CreateProcessInstance` | Start a new process instance |
78
+ | `CancelProcessInstance` | Cancel a running process instance |
79
+ | `ActivateJobs` | Activate jobs for processing (bounded) |
80
+ | `StreamActivatedJobs` | Stream jobs as they become available (long-lived) |
81
+ | `CompleteJob` | Mark a job as successfully completed |
82
+ | `FailJob` | Mark a job as failed |
83
+ | `ThrowError` | Throw a BPMN error from a job |
84
+ | `PublishMessage` | Publish a message for correlation |
85
+ | `SetVariables` | Update variables on a scope |
86
+ | `ResolveIncident` | Resolve an incident |
87
+ | `UpdateJobRetries` | Update retry count for a job |
88
+ | `UpdateJobTimeout` | Extend or shorten a job's deadline |
89
+ | `BroadcastSignal` | Broadcast a BPMN signal |
90
+ | `ModifyProcessInstance` | Modify a running process instance |
91
+ | `MigrateProcessInstance` | Migrate a process instance to a new version |
92
+
93
+ See the [Zeebe gRPC API documentation](https://docs.camunda.io/docs/apis-tools/zeebe-api/) for full details on request/response structures.
94
+
95
+ ## Authentication
96
+
97
+ For local development with an insecure connection:
98
+
99
+ ```ruby
100
+ stub = Busybee::GRPC::Gateway::Stub.new(
101
+ "localhost:26500",
102
+ :this_channel_is_insecure
103
+ )
104
+ ```
105
+
106
+ For Camunda Cloud or TLS-secured clusters, you'll need to construct appropriate channel credentials. The upcoming `Busybee::Client` will handle this automatically; at the GRPC level, refer to the [grpc gem documentation](https://grpc.io/docs/languages/ruby/basics/) for credential setup.