beez 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +173 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/Rakefile +6 -0
- data/beez.gemspec +36 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bpmn/order-process.bpmn +139 -0
- data/examples/workers.rb +49 -0
- data/exe/beez +14 -0
- data/lib/beez.rb +26 -0
- data/lib/beez/cli.rb +143 -0
- data/lib/beez/client.rb +97 -0
- data/lib/beez/configurable.rb +13 -0
- data/lib/beez/configuration.rb +14 -0
- data/lib/beez/launcher.rb +35 -0
- data/lib/beez/loggable.rb +15 -0
- data/lib/beez/processor.rb +103 -0
- data/lib/beez/rails.rb +29 -0
- data/lib/beez/supervisor.rb +38 -0
- data/lib/beez/version.rb +3 -0
- data/lib/beez/worker.rb +163 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 00ef11a3ca7ca867e66aec2bddbabb14782c8500f89ce3c9d2dea83b9e176376
|
4
|
+
data.tar.gz: 8169c79c40bfa2ad7fe4bdff6dd0c4be90f9819a656c3e7c61a528266b65541d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d0db3745da493181195e3fb4af5cb956c566ab63be42b19a5fdffcb17a9d8bbf0353c6c70d717c092a7851636977bec2150fc46bf8765f3f5989fbc32f190a87
|
7
|
+
data.tar.gz: 86fed6e91dd1671e858e76fb17c6f801c020ae023c1c1ff6e796b07113d03518fa670222b6a2f5a49c2b0b8c0c198f9ffeb56e35e1ee7a765081ac405f8acd72
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.6
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at pierrelouis.gottfrois@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
beez (0.1.0)
|
5
|
+
concurrent-ruby (~> 1.0)
|
6
|
+
zeebe-client (~> 0.7)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (6.0.3.2)
|
12
|
+
actionpack (= 6.0.3.2)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.0.3.2)
|
16
|
+
actionpack (= 6.0.3.2)
|
17
|
+
activejob (= 6.0.3.2)
|
18
|
+
activerecord (= 6.0.3.2)
|
19
|
+
activestorage (= 6.0.3.2)
|
20
|
+
activesupport (= 6.0.3.2)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.0.3.2)
|
23
|
+
actionpack (= 6.0.3.2)
|
24
|
+
actionview (= 6.0.3.2)
|
25
|
+
activejob (= 6.0.3.2)
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
actionpack (6.0.3.2)
|
29
|
+
actionview (= 6.0.3.2)
|
30
|
+
activesupport (= 6.0.3.2)
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
32
|
+
rack-test (>= 0.6.3)
|
33
|
+
rails-dom-testing (~> 2.0)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.0.3.2)
|
36
|
+
actionpack (= 6.0.3.2)
|
37
|
+
activerecord (= 6.0.3.2)
|
38
|
+
activestorage (= 6.0.3.2)
|
39
|
+
activesupport (= 6.0.3.2)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.0.3.2)
|
42
|
+
activesupport (= 6.0.3.2)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubi (~> 1.4)
|
45
|
+
rails-dom-testing (~> 2.0)
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.0.3.2)
|
48
|
+
activesupport (= 6.0.3.2)
|
49
|
+
globalid (>= 0.3.6)
|
50
|
+
activemodel (6.0.3.2)
|
51
|
+
activesupport (= 6.0.3.2)
|
52
|
+
activerecord (6.0.3.2)
|
53
|
+
activemodel (= 6.0.3.2)
|
54
|
+
activesupport (= 6.0.3.2)
|
55
|
+
activestorage (6.0.3.2)
|
56
|
+
actionpack (= 6.0.3.2)
|
57
|
+
activejob (= 6.0.3.2)
|
58
|
+
activerecord (= 6.0.3.2)
|
59
|
+
marcel (~> 0.3.1)
|
60
|
+
activesupport (6.0.3.2)
|
61
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
+
i18n (>= 0.7, < 2)
|
63
|
+
minitest (~> 5.1)
|
64
|
+
tzinfo (~> 1.1)
|
65
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
66
|
+
builder (3.2.4)
|
67
|
+
coderay (1.1.3)
|
68
|
+
concurrent-ruby (1.1.6)
|
69
|
+
crass (1.0.6)
|
70
|
+
diff-lcs (1.4.4)
|
71
|
+
erubi (1.9.0)
|
72
|
+
globalid (0.4.2)
|
73
|
+
activesupport (>= 4.2.0)
|
74
|
+
google-protobuf (3.12.2)
|
75
|
+
googleapis-common-protos-types (1.0.5)
|
76
|
+
google-protobuf (~> 3.11)
|
77
|
+
grpc (1.27.0)
|
78
|
+
google-protobuf (~> 3.11)
|
79
|
+
googleapis-common-protos-types (~> 1.0)
|
80
|
+
i18n (1.8.3)
|
81
|
+
concurrent-ruby (~> 1.0)
|
82
|
+
loofah (2.6.0)
|
83
|
+
crass (~> 1.0.2)
|
84
|
+
nokogiri (>= 1.5.9)
|
85
|
+
mail (2.7.1)
|
86
|
+
mini_mime (>= 0.1.1)
|
87
|
+
marcel (0.3.3)
|
88
|
+
mimemagic (~> 0.3.2)
|
89
|
+
method_source (1.0.0)
|
90
|
+
mimemagic (0.3.5)
|
91
|
+
mini_mime (1.0.2)
|
92
|
+
mini_portile2 (2.4.0)
|
93
|
+
minitest (5.14.1)
|
94
|
+
nio4r (2.5.2)
|
95
|
+
nokogiri (1.10.10)
|
96
|
+
mini_portile2 (~> 2.4.0)
|
97
|
+
pry (0.13.1)
|
98
|
+
coderay (~> 1.1)
|
99
|
+
method_source (~> 1.0)
|
100
|
+
rack (2.2.3)
|
101
|
+
rack-test (1.1.0)
|
102
|
+
rack (>= 1.0, < 3)
|
103
|
+
rails (6.0.3.2)
|
104
|
+
actioncable (= 6.0.3.2)
|
105
|
+
actionmailbox (= 6.0.3.2)
|
106
|
+
actionmailer (= 6.0.3.2)
|
107
|
+
actionpack (= 6.0.3.2)
|
108
|
+
actiontext (= 6.0.3.2)
|
109
|
+
actionview (= 6.0.3.2)
|
110
|
+
activejob (= 6.0.3.2)
|
111
|
+
activemodel (= 6.0.3.2)
|
112
|
+
activerecord (= 6.0.3.2)
|
113
|
+
activestorage (= 6.0.3.2)
|
114
|
+
activesupport (= 6.0.3.2)
|
115
|
+
bundler (>= 1.3.0)
|
116
|
+
railties (= 6.0.3.2)
|
117
|
+
sprockets-rails (>= 2.0.0)
|
118
|
+
rails-dom-testing (2.0.3)
|
119
|
+
activesupport (>= 4.2.0)
|
120
|
+
nokogiri (>= 1.6)
|
121
|
+
rails-html-sanitizer (1.3.0)
|
122
|
+
loofah (~> 2.3)
|
123
|
+
railties (6.0.3.2)
|
124
|
+
actionpack (= 6.0.3.2)
|
125
|
+
activesupport (= 6.0.3.2)
|
126
|
+
method_source
|
127
|
+
rake (>= 0.8.7)
|
128
|
+
thor (>= 0.20.3, < 2.0)
|
129
|
+
rake (12.3.3)
|
130
|
+
rspec (3.9.0)
|
131
|
+
rspec-core (~> 3.9.0)
|
132
|
+
rspec-expectations (~> 3.9.0)
|
133
|
+
rspec-mocks (~> 3.9.0)
|
134
|
+
rspec-core (3.9.2)
|
135
|
+
rspec-support (~> 3.9.3)
|
136
|
+
rspec-expectations (3.9.2)
|
137
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
138
|
+
rspec-support (~> 3.9.0)
|
139
|
+
rspec-mocks (3.9.1)
|
140
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
141
|
+
rspec-support (~> 3.9.0)
|
142
|
+
rspec-support (3.9.3)
|
143
|
+
sprockets (4.0.2)
|
144
|
+
concurrent-ruby (~> 1.0)
|
145
|
+
rack (> 1, < 3)
|
146
|
+
sprockets-rails (3.2.1)
|
147
|
+
actionpack (>= 4.0)
|
148
|
+
activesupport (>= 4.0)
|
149
|
+
sprockets (>= 3.0.0)
|
150
|
+
thor (1.0.1)
|
151
|
+
thread_safe (0.3.6)
|
152
|
+
tzinfo (1.2.7)
|
153
|
+
thread_safe (~> 0.1)
|
154
|
+
websocket-driver (0.7.3)
|
155
|
+
websocket-extensions (>= 0.1.0)
|
156
|
+
websocket-extensions (0.1.5)
|
157
|
+
zeebe-client (0.10.1)
|
158
|
+
grpc (~> 1.27.0)
|
159
|
+
zeitwerk (2.4.0)
|
160
|
+
|
161
|
+
PLATFORMS
|
162
|
+
ruby
|
163
|
+
|
164
|
+
DEPENDENCIES
|
165
|
+
beez!
|
166
|
+
bundler
|
167
|
+
pry
|
168
|
+
rails (>= 4)
|
169
|
+
rake (~> 12.0)
|
170
|
+
rspec (~> 3.0)
|
171
|
+
|
172
|
+
BUNDLED WITH
|
173
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Pierre-Louis Gottfrois
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
# Beez
|
2
|
+
|
3
|
+
Simple, efficient ruby workers for [Zeebe](https://zeebe.io/) business processes.
|
4
|
+
|
5
|
+
Beez uses threads to handle many jobs at the same time in the same process. It
|
6
|
+
does not require Rails but will integrate tightly with Rails to start working
|
7
|
+
with workflows.
|
8
|
+
|
9
|
+
## Disclaimer
|
10
|
+
|
11
|
+
Beez is currently **not production ready**. It hasn't been tested under a
|
12
|
+
production application yet. Beside, the gem is missing all its specs at the
|
13
|
+
moment.
|
14
|
+
|
15
|
+
I'm working on this project on my free time. If you want to help, be my guest! I
|
16
|
+
love the concepts behind Zeebe, this is why I bootstraped this library.
|
17
|
+
|
18
|
+
Please bare with me while it matures.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem 'beez'
|
26
|
+
```
|
27
|
+
|
28
|
+
And then execute:
|
29
|
+
|
30
|
+
$ bundle
|
31
|
+
|
32
|
+
Or install it yourself as:
|
33
|
+
|
34
|
+
$ gem install beez
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
The following guide assumes you already have the Zeebe stack up and running and
|
39
|
+
a workflow deployed. If not, please head to [Zeebe official documentation](https://docs.zeebe.io/).
|
40
|
+
|
41
|
+
We will be taking the classic Order Process workflows as an example.
|
42
|
+
|
43
|
+
![Order Process](https://docs.zeebe.io/getting-started/img/tutorial-3.0-complete-workflow.png)
|
44
|
+
|
45
|
+
### Rails
|
46
|
+
|
47
|
+
1. Create the workers anywhere you want in your Rails application:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
class InitiatePaymentWorker
|
51
|
+
include ::Beez::Worker
|
52
|
+
|
53
|
+
type "initiate-payment"
|
54
|
+
|
55
|
+
def process(job)
|
56
|
+
# do something
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class ShipWithInsuranceWorker
|
61
|
+
include ::Beez::Worker
|
62
|
+
|
63
|
+
type "ship-with-insurance"
|
64
|
+
|
65
|
+
def process(job)
|
66
|
+
# do something
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class ShipWithoutInsuranceWorker
|
71
|
+
include ::Beez::Worker
|
72
|
+
|
73
|
+
type "ship-without-insurance"
|
74
|
+
|
75
|
+
def process(job)
|
76
|
+
# do something
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
*You can find the available properties of the `job` variable [here](https://github.com/zeebe-io/zeebe-client-ruby/blob/master/lib/zeebe/client/proto/gateway_pb.rb#L20-L32).*
|
82
|
+
|
83
|
+
2. Start Beez from the root of your Rails application:
|
84
|
+
|
85
|
+
```sh
|
86
|
+
bundle exec beez
|
87
|
+
```
|
88
|
+
|
89
|
+
That's it.
|
90
|
+
|
91
|
+
### Plain Ruby
|
92
|
+
|
93
|
+
You can skip loading the Rails application entirely by specifying workers within
|
94
|
+
a ruby file when starting Beez:
|
95
|
+
|
96
|
+
```sh
|
97
|
+
bundle exec beez -r ./workers.rb
|
98
|
+
```
|
99
|
+
|
100
|
+
*Check out our examples in `examples/` folder.*
|
101
|
+
|
102
|
+
### Zeebe Client
|
103
|
+
|
104
|
+
You can interact with Zeebe and your workflows directly from Beez:
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
client = Beez.client
|
108
|
+
|
109
|
+
# Deploys a new version of the Order Process workflow
|
110
|
+
client.deploy_workflow(name: "order-process", type: :BPMN, definition: File.read('./bnmn/order-process.bpmn'))
|
111
|
+
|
112
|
+
# Creates a new Order Process workflow instance
|
113
|
+
client.create_workflow_instance(bpmnProcessId: "order-process", version: 1, variables: { orderId: "1234", orderValue: 94 }.to_json)
|
114
|
+
|
115
|
+
# Publishes a business message
|
116
|
+
client.publish_message(name: "payment-received", correlationKey: "1234")
|
117
|
+
```
|
118
|
+
|
119
|
+
*Check out all the available commands in `lib/beez/client.rb`.*
|
120
|
+
|
121
|
+
## Development
|
122
|
+
|
123
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
124
|
+
|
125
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gottfrois/beez.
|
130
|
+
|
131
|
+
## License
|
132
|
+
|
133
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
134
|
+
|
135
|
+
## Thanks
|
136
|
+
|
137
|
+
I would like to thank you the authors and contributors behind
|
138
|
+
[Sidekiq](https://github.com/mperham/sidekiq) on which I have taken lots of good
|
139
|
+
ideas to build this gem.
|