ikibana 0.1.1 → 0.1.2
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/.rubocop.yml +3 -0
- data/LICENSE +23 -0
- data/README.md +47 -24
- data/lib/ikibana/application_consumer.rb +1 -0
- data/lib/ikibana/config.rb +8 -3
- data/lib/ikibana/version.rb +1 -1
- metadata +2 -3
- data/LICENSE.txt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45c1dc8b32754fa13088ad4cba0df313f31874f788fde1593bc061acaa240128
|
4
|
+
data.tar.gz: 5c1e8c20df29ba0ef594c4be82ceaf68a0b01b66a97277c70ad1ffcab6a396dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97f2ac89850a756abdc2e286f88a0238393798269e817098218841f9358fef1a8380acab16a063daeb154a028be5c7fb81b0e2f53847c9006b38d43dc0eec12a
|
7
|
+
data.tar.gz: 7f0084d50ebb8bcfdc79a71fa759dab29b197513eaa207031756255d8bcb5555312e5c3562a017b2a44448733eaf03f6d9d47ee4313f2b7365ef13fd13e04716
|
data/.rubocop.yml
CHANGED
data/LICENSE
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
This project includes the following third-party libraries:
|
2
|
+
|
3
|
+
- nats-pure - Licensed under the Apache License, Version 2.0
|
4
|
+
https://github.com/nats-io/nats-pure.rb
|
5
|
+
|
6
|
+
- debug - Licensed under the BSD 2-Clause "Simplified" License
|
7
|
+
https://github.com/ruby/debug
|
8
|
+
|
9
|
+
- rails - Licensed under the MIT License
|
10
|
+
https://github.com/rails/rails
|
11
|
+
|
12
|
+
- rake - Licensed under the MIT License
|
13
|
+
https://github.com/ruby/rake
|
14
|
+
|
15
|
+
- rspec - Licensed under the MIT License
|
16
|
+
https://rubygems.org/gems/rspec
|
17
|
+
|
18
|
+
- rubocop - Licensed under the MIT License
|
19
|
+
https://github.com/rubocop/rubocop
|
20
|
+
|
21
|
+
- github_changelog_generator - Licensed under the MIT License
|
22
|
+
https://github.com/github-changelog-generator/github-changelog-generator
|
23
|
+
|
1
24
|
Apache License
|
2
25
|
Version 2.0, January 2004
|
3
26
|
http://www.apache.org/licenses/
|
data/README.md
CHANGED
@@ -1,51 +1,74 @@
|
|
1
1
|
# Ikibana
|
2
|
+
|
2
3
|
This is a work in progress.
|
3
4
|
|
4
5
|
Ikibana is a simple and easy to use Rails background job runner that uses NATS JetStream as a message broker.
|
5
6
|
Just like `sidekiq` or `sneakers`, but allowing to create distributed applications or microservices with ease.
|
6
7
|
|
7
8
|
## Usage
|
9
|
+
|
8
10
|
To install:
|
11
|
+
|
9
12
|
```bash
|
10
13
|
gem install ikibana
|
11
14
|
```
|
15
|
+
|
12
16
|
Or add this line to your application's Gemfile:
|
17
|
+
|
13
18
|
```ruby
|
14
19
|
gem 'ikibana'
|
15
20
|
```
|
16
|
-
|
21
|
+
|
22
|
+
Then in a Rails application context execute
|
23
|
+
|
17
24
|
```bash
|
18
25
|
bundle exec rails g ikibana:install
|
19
26
|
```
|
20
27
|
|
21
|
-
This will create a `config/initializers/ikibana.rb` file alongside with `config/nats.yaml` file with the default
|
28
|
+
This will create a `config/initializers/ikibana.rb` file alongside with `config/nats.yaml` file with the default
|
29
|
+
configuration.
|
22
30
|
At the moment there are only two options available for configuration:
|
23
|
-
|
24
|
-
*
|
31
|
+
|
32
|
+
* logger: The logger to use. Defaults to `Logger.new`.
|
33
|
+
*
|
34
|
+
* this can be replaced with any logger that responds to `info`, `warn`, `error` and `debug` methods.
|
25
35
|
* cache: The cache to use. Defaults to none.
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
36
|
+
*
|
37
|
+
* there is a class that can be inherited for implementing your own cache `Ikibana::ICache`.
|
38
|
+
*
|
39
|
+
* the cache at the moment has to respond to `write` and `read` methods
|
40
|
+
*
|
41
|
+
*
|
42
|
+
* can be replaced with `Rails.cache` at the moment
|
29
43
|
|
30
44
|
## Features
|
31
|
-
* Generation of consumers: `rails g ikibana:consumer <name>` where name can be any ruby constant identifier.
|
32
|
-
* * for example `rails g ikibana:consumer A::B::C` will generate a consumer `A::B::CConsumer` that will listen to the `a.b.c` subject.
|
33
|
-
* * The consumer has one private method `perform(msg)` that will be called when a message is received. This is where you will implement your application logic.
|
34
|
-
* Producer: At the moment the only way to produce messages would be `Ikibana::Config.instance.js.publish(subject, payload)`
|
35
|
-
* * This will be replaced with a more user-friendly and idiomatic way of producing messages in the future.
|
36
45
|
|
46
|
+
* Generation of consumers: `rails g ikibana:consumer <name>` where name can be any ruby constant identifier.
|
47
|
+
*
|
48
|
+
* for example `rails g ikibana:consumer A::B::C` will generate a consumer `A::B::CConsumer` that will listen to the
|
49
|
+
`a.b.c` subject.
|
50
|
+
*
|
51
|
+
* The consumer has one private method `perform(msg)` that will be called when a message is received. This is where
|
52
|
+
you will implement your application logic.
|
53
|
+
* Producer: At the moment the only way to produce messages would be
|
54
|
+
`Ikibana::Config.instance.js.publish(subject, payload)`
|
55
|
+
*
|
56
|
+
* This will be replaced with a more user-friendly and idiomatic way of producing messages in the future.
|
37
57
|
|
38
58
|
## Roadmap
|
39
59
|
|
40
|
-
| Feature Name
|
41
|
-
|
42
|
-
| Generation of consumers
|
43
|
-
| Logger configuration
|
44
|
-
| Cache configuration
|
45
|
-
| Consumer placement mechanism
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| Producer
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
| Feature Name | Status |
|
61
|
+
|----------------------------------------|---------------------------------------------------------|
|
62
|
+
| Generation of consumers | Implemented |
|
63
|
+
| Logger configuration | Implemented |
|
64
|
+
| Cache configuration | To be improved(NATS k/v storage instead of Rails cache) |
|
65
|
+
| Consumer placement mechanism | To be implemented |
|
66
|
+
| Consumer type(sync/async/at_most_once) | To be implemented |
|
67
|
+
| CLI to start all the consumers | To be implemented |
|
68
|
+
| Producer DSL | To be implemented |
|
69
|
+
| Producer configuration | To be implemented |
|
70
|
+
| Test coverage | To be implemented |
|
71
|
+
| Documentation | To be improved |
|
72
|
+
| Examples | To be implemented |
|
73
|
+
| Complete Rails integration | To be implemented |
|
74
|
+
| Stand alone mode | To be implemented |
|
data/lib/ikibana/config.rb
CHANGED
@@ -7,8 +7,13 @@ require "nats/client"
|
|
7
7
|
|
8
8
|
module Ikibana
|
9
9
|
class ICache
|
10
|
-
def write(...)
|
11
|
-
|
10
|
+
def write(...)
|
11
|
+
raise NotImplementedError, "Subclasses must implement a `write` method"
|
12
|
+
end
|
13
|
+
|
14
|
+
def read(...)
|
15
|
+
raise NotImplementedError, "Subclasses must implement a `read` method"
|
16
|
+
end
|
12
17
|
end
|
13
18
|
|
14
19
|
# Configuration class for NATS
|
@@ -30,7 +35,7 @@ module Ikibana
|
|
30
35
|
@logger.error("#{e.class}: Error connecting to NATS server: #{e.message}")
|
31
36
|
end
|
32
37
|
|
33
|
-
def self.configure(
|
38
|
+
def self.configure(_config_file = "config/nats.yaml")
|
34
39
|
yield instance if block_given?
|
35
40
|
end
|
36
41
|
|
data/lib/ikibana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ikibana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aram
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nats-pure
|
@@ -39,7 +39,6 @@ files:
|
|
39
39
|
- CHANGELOG.md
|
40
40
|
- CODE_OF_CONDUCT.md
|
41
41
|
- LICENSE
|
42
|
-
- LICENSE.txt
|
43
42
|
- README.md
|
44
43
|
- Rakefile
|
45
44
|
- exe/ikibana
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2024 Aram
|
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.
|