messaging 3.5.5 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +17 -33
- data/.env +2 -0
- data/Dockerfile +37 -0
- data/Gemfile.lock +15 -17
- data/README.md +34 -1
- data/bin/de +11 -0
- data/bin/setup +19 -6
- data/bin/setup_db +3 -0
- data/docker-compose.yml +68 -0
- data/lib/messaging/adapters/kafka/producer.rb +1 -1
- data/lib/messaging/adapters/postgres/serialized_message.rb +1 -1
- data/lib/messaging/adapters/postgres/stream.rb +8 -1
- data/lib/messaging/adapters/postgres.rb +52 -0
- data/lib/messaging/config.rb +23 -23
- data/lib/messaging/rails/railtie.rb +4 -0
- data/lib/messaging/routes.rb +12 -1
- data/lib/messaging/version.rb +1 -1
- metadata +8 -4
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a0796bdb3f12989241e5796631d0b2c398801515a4f56cb125f219cc3090102
|
4
|
+
data.tar.gz: f1e8d939623c1e877283889de5d5cef450a121f1b9832cb00ac110964fa64f3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6186033688ac0d6c7c713259e92038b35bf405c10258eea01c4b4d17508603c6e2b1a421dc51b1998cfcdc926314121dac9c3cb84337d8091cc456adc097c9fc
|
7
|
+
data.tar.gz: db64b2338a964ab8a52562c837a1afcc9b7b8789ba919fec0f08c5e0ea490b6dae45cd4cbe30fe3ba105c4652b894985ca5b68d50b996cf8a2f79a8bdb95c95c
|
data/.circleci/config.yml
CHANGED
@@ -5,42 +5,32 @@
|
|
5
5
|
version: 2
|
6
6
|
jobs:
|
7
7
|
build:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
environment:
|
12
|
-
CC_TEST_REPORTER_ID: 94ada9b95ee3f232a6e984809d37917cfee90ac47805429e8c49742b2e8d2276
|
13
|
-
RAILS_ENV: test
|
14
|
-
- image: circleci/postgres:9.6.6-alpine
|
15
|
-
environment:
|
16
|
-
POSTGRES_USER: postgres
|
17
|
-
|
8
|
+
machine:
|
9
|
+
image: ubuntu-2004:202111-02
|
10
|
+
docker_layer_caching: true
|
18
11
|
working_directory: ~/repo
|
12
|
+
environment:
|
13
|
+
RUBY_VERSION: 2.6.6-buster
|
14
|
+
RAILS_ENV: test
|
19
15
|
|
20
16
|
steps:
|
21
|
-
- run:
|
22
|
-
name: Install aptitude because it has much more helpful error messages when ending up in dependency hell
|
23
|
-
command: sudo apt-get install --assume-yes aptitude
|
24
|
-
|
25
|
-
- run:
|
26
|
-
name: Install Postgres Client
|
27
|
-
command: sudo aptitude -y install postgresql-client
|
28
|
-
|
29
17
|
- checkout
|
30
18
|
|
31
|
-
- run:
|
32
|
-
name: Setup Code Climate test-reporter
|
33
|
-
command: |
|
34
|
-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
35
|
-
chmod +x ./cc-test-reporter
|
36
|
-
|
37
19
|
- restore_cache:
|
38
20
|
name: Restore Bundler Cache
|
39
21
|
key: messaging-bundle-{{ checksum "Gemfile.lock" }}
|
40
22
|
|
23
|
+
- run:
|
24
|
+
name: start postgres runner
|
25
|
+
command: docker-compose up -d postgres
|
26
|
+
|
27
|
+
- run:
|
28
|
+
name: Build runner
|
29
|
+
command: docker-compose --verbose build runner
|
30
|
+
|
41
31
|
- run:
|
42
32
|
name: install dependencies
|
43
|
-
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
33
|
+
command: bin/de bundle install --jobs=4 --retry=3 --path vendor/bundle
|
44
34
|
|
45
35
|
- save_cache:
|
46
36
|
key: messagin-bundle-{{ checksum "Gemfile.lock" }}
|
@@ -49,17 +39,11 @@ jobs:
|
|
49
39
|
|
50
40
|
- run:
|
51
41
|
name: Database Setup
|
52
|
-
command:
|
53
|
-
cd spec/example_app
|
54
|
-
bin/rails db:create
|
55
|
-
bin/rails db:migrate
|
42
|
+
command: bin/de bin/setup_db
|
56
43
|
|
57
44
|
- run:
|
58
45
|
name: run tests
|
59
|
-
command:
|
60
|
-
./cc-test-reporter before-build
|
61
|
-
bundle exec rspec
|
62
|
-
./cc-test-reporter after-build --exit-code $?
|
46
|
+
command: bin/de bundle exec rspec
|
63
47
|
|
64
48
|
workflows:
|
65
49
|
version: 2
|
data/Dockerfile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# ** Common setup for all stages
|
2
|
+
ARG BASE_IMAGE=ruby:2.6.6-buster
|
3
|
+
FROM $BASE_IMAGE
|
4
|
+
|
5
|
+
ARG PG_VERSION=12
|
6
|
+
ENV LANG=C.UTF-8
|
7
|
+
|
8
|
+
# See https://askubuntu.com/questions/972516/debian-frontend-environment-variable/972528#972528
|
9
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
10
|
+
|
11
|
+
RUN apt-get update -q \
|
12
|
+
&& apt-get install -yq --no-install-recommends \
|
13
|
+
build-essential \
|
14
|
+
curl \
|
15
|
+
gnupg \
|
16
|
+
less \
|
17
|
+
postgresql-common \
|
18
|
+
vim \
|
19
|
+
wget
|
20
|
+
|
21
|
+
# Install Postgresql apt repository so we can install PG
|
22
|
+
RUN (yes || true) | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
|
23
|
+
|
24
|
+
# Install more packages after updated apt-repos
|
25
|
+
RUN apt-get update -q \
|
26
|
+
&& apt-get install --no-install-recommends -yq \
|
27
|
+
libpq-dev \
|
28
|
+
postgresql-client-$PG_VERSION
|
29
|
+
|
30
|
+
# Create a directory for the app code
|
31
|
+
RUN mkdir -p /app
|
32
|
+
WORKDIR /app
|
33
|
+
ENV PATH=/app/bin:$PATH
|
34
|
+
|
35
|
+
# Configure bundler
|
36
|
+
ENV BUNDLE_JOBS=4
|
37
|
+
ENV BUNDLE_RETRY=3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
messaging (3.
|
4
|
+
messaging (3.6.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
after_transaction
|
@@ -45,8 +45,8 @@ GEM
|
|
45
45
|
tzinfo (~> 1.1)
|
46
46
|
addressable (2.7.0)
|
47
47
|
public_suffix (>= 2.0.2, < 5.0)
|
48
|
-
after_transaction (0.0.
|
49
|
-
activerecord
|
48
|
+
after_transaction (0.0.5)
|
49
|
+
activerecord
|
50
50
|
arel (9.0.0)
|
51
51
|
axiom-types (0.1.1)
|
52
52
|
descendants_tracker (~> 0.0.4)
|
@@ -73,24 +73,23 @@ GEM
|
|
73
73
|
descendants_tracker (0.0.4)
|
74
74
|
thread_safe (~> 0.3, >= 0.3.1)
|
75
75
|
diff-lcs (1.3)
|
76
|
-
digest-crc (0.
|
76
|
+
digest-crc (0.6.0)
|
77
77
|
dnsruby (1.61.3)
|
78
78
|
addressable (~> 2.5)
|
79
79
|
docile (1.3.2)
|
80
|
-
dry-configurable (0.
|
80
|
+
dry-configurable (0.13.0)
|
81
81
|
concurrent-ruby (~> 1.0)
|
82
|
-
dry-core (~> 0.
|
83
|
-
dry-container (0.
|
82
|
+
dry-core (~> 0.6)
|
83
|
+
dry-container (0.9.0)
|
84
84
|
concurrent-ruby (~> 1.0)
|
85
|
-
dry-configurable (~> 0.
|
86
|
-
dry-core (0.
|
85
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
86
|
+
dry-core (0.7.1)
|
87
87
|
concurrent-ruby (~> 1.0)
|
88
|
-
dry-equalizer (0.
|
89
|
-
dry-initializer (3.0.
|
88
|
+
dry-equalizer (0.3.0)
|
89
|
+
dry-initializer (3.0.4)
|
90
90
|
em-websocket (0.5.1)
|
91
91
|
eventmachine (>= 0.12.9)
|
92
92
|
http_parser.rb (~> 0.6.0)
|
93
|
-
equalizer (0.0.11)
|
94
93
|
erubi (1.9.0)
|
95
94
|
ethon (0.12.0)
|
96
95
|
ffi (>= 1.3.0)
|
@@ -151,7 +150,7 @@ GEM
|
|
151
150
|
octokit (~> 4.0)
|
152
151
|
public_suffix (~> 3.0)
|
153
152
|
typhoeus (~> 1.3)
|
154
|
-
hashie (
|
153
|
+
hashie (5.0.0)
|
155
154
|
html-pipeline (2.12.2)
|
156
155
|
activesupport (>= 2)
|
157
156
|
nokogiri (>= 1.4)
|
@@ -285,7 +284,7 @@ GEM
|
|
285
284
|
nokogiri (>= 1.5.9)
|
286
285
|
maxminddb (0.1.8)
|
287
286
|
mercenary (0.3.6)
|
288
|
-
meter (1.
|
287
|
+
meter (1.3.0)
|
289
288
|
locality (~> 1.1.0)
|
290
289
|
useragent (~> 0.16.3)
|
291
290
|
method_object (1.0.0)
|
@@ -358,7 +357,7 @@ GEM
|
|
358
357
|
rspec-support (3.9.0)
|
359
358
|
ruby-enum (0.7.2)
|
360
359
|
i18n
|
361
|
-
ruby-kafka (1.
|
360
|
+
ruby-kafka (1.4.0)
|
362
361
|
digest-crc
|
363
362
|
rubyzip (1.3.0)
|
364
363
|
safe_yaml (1.0.5)
|
@@ -391,11 +390,10 @@ GEM
|
|
391
390
|
thread_safe (~> 0.1)
|
392
391
|
unicode-display_width (1.6.0)
|
393
392
|
useragent (0.16.10)
|
394
|
-
virtus (
|
393
|
+
virtus (2.0.0)
|
395
394
|
axiom-types (~> 0.1)
|
396
395
|
coercible (~> 1.0)
|
397
396
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
398
|
-
equalizer (~> 0.0, >= 0.0.9)
|
399
397
|
|
400
398
|
PLATFORMS
|
401
399
|
ruby
|
data/README.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
1
|
A library for decoupling applications by using messaging to communicate between components.
|
2
2
|
|
3
|
-
|
3
|
+
## Local development
|
4
|
+
|
5
|
+
### Setting up Postgresql and Kafka:
|
6
|
+
|
7
|
+
```
|
8
|
+
$ docker-compose up -d kafka postgres
|
9
|
+
```
|
10
|
+
|
11
|
+
If you want to try different version of PG (the default is 12) you can use the environment variable PG_VERSION.
|
12
|
+
|
13
|
+
```
|
14
|
+
$ PG_VERSION=13 docker-compose up -Vd postgres
|
15
|
+
```
|
16
|
+
|
17
|
+
The -V option is for recreating the volume instead of using the one from the previous container. The volume are prefixed with the pg version so that they are indenpendent from each other.
|
18
|
+
|
19
|
+
|
20
|
+
If you already have PG and Kafka running with another compose project you can skip running them and use the environment variables EXTERNAL_NETWORK and NETWORK_NAME:
|
21
|
+
|
22
|
+
```
|
23
|
+
$ EXTERNAL_NETWORK=myproject_default NETWORK_NAME=external docker-compose start runner
|
24
|
+
```
|
25
|
+
|
26
|
+
### Setting up the development environment
|
27
|
+
|
28
|
+
The "runner" service is used for interacting with the code. Bundling, starting a console and running specs etc.
|
29
|
+
|
30
|
+
After PG and Kafka are up and running just run
|
31
|
+
|
32
|
+
```
|
33
|
+
$ bin/setup
|
34
|
+
```
|
35
|
+
|
36
|
+
TODO: Actually implement the bin/setup command :-)
|
data/bin/de
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
project_name=${PWD##*/}
|
4
|
+
|
5
|
+
get_container_id () {
|
6
|
+
docker container ls | grep "${project_name}_runner" | awk '{print $1}'
|
7
|
+
}
|
8
|
+
|
9
|
+
container_id=$([[ $(get_container_id) ]] || docker-compose up -d runner && get_container_id)
|
10
|
+
|
11
|
+
docker exec -it $container_id "${@}"
|
data/bin/setup
CHANGED
@@ -1,8 +1,21 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
5
3
|
|
6
|
-
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
6
|
|
8
|
-
|
7
|
+
def system!(*args)
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts "\n== Setup development database =="
|
17
|
+
system! './bin/de rails db:reset'
|
18
|
+
|
19
|
+
puts "\n== Setup test database =="
|
20
|
+
system! './bin/de rails db:reset RAILS_ENV=test'
|
21
|
+
end
|
data/bin/setup_db
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
version: '3.4'
|
2
|
+
|
3
|
+
x-shared: &shared
|
4
|
+
build:
|
5
|
+
context: .
|
6
|
+
dockerfile: ./Dockerfile
|
7
|
+
args:
|
8
|
+
RUBY_VERSION: ${RUBY_VERSION}
|
9
|
+
BASE_IMAGE: ruby:${RUBY_VERSION}
|
10
|
+
PG_VERSION: ${PG_VERSION}
|
11
|
+
tmpfs:
|
12
|
+
- /tmp
|
13
|
+
environment:
|
14
|
+
- RAILS_ENV=${RAILS_ENV:-development}
|
15
|
+
- BOOTSNAP_CACHE_DIR=/rails_cache/bootsnap
|
16
|
+
volumes:
|
17
|
+
- .:/app
|
18
|
+
- bundle:/usr/local/bundle
|
19
|
+
networks:
|
20
|
+
- ${NETWORK_NAME:-default}
|
21
|
+
|
22
|
+
services:
|
23
|
+
runner:
|
24
|
+
<<: *shared
|
25
|
+
stdin_open: true
|
26
|
+
tty: true
|
27
|
+
command: /bin/sh
|
28
|
+
|
29
|
+
postgres:
|
30
|
+
image: postgres:${PG_VERSION}
|
31
|
+
volumes:
|
32
|
+
- pg_data:/var/lib/postgresql/data
|
33
|
+
ports:
|
34
|
+
- 5432:5432
|
35
|
+
environment:
|
36
|
+
- POSTGRES_HOST_AUTH_METHOD=trust
|
37
|
+
|
38
|
+
zookeeper:
|
39
|
+
image: zookeeper
|
40
|
+
ports:
|
41
|
+
- "2181:2181"
|
42
|
+
|
43
|
+
kafka:
|
44
|
+
image: niks123123/kafka:2.7.0
|
45
|
+
ports:
|
46
|
+
- "9092:9092"
|
47
|
+
depends_on:
|
48
|
+
- zookeeper
|
49
|
+
environment:
|
50
|
+
KAFKA_ADVERTISED_HOST_NAME: kafka
|
51
|
+
KAFKA_ADVERTISED_PORT: 9092
|
52
|
+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
53
|
+
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
|
54
|
+
volumes:
|
55
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
56
|
+
|
57
|
+
volumes:
|
58
|
+
bundle:
|
59
|
+
name: bundle_${RUBY_VERSION}
|
60
|
+
pg_data:
|
61
|
+
name: pg_data_${PG_VERSION}
|
62
|
+
|
63
|
+
networks:
|
64
|
+
default:
|
65
|
+
name: messaging_default
|
66
|
+
external:
|
67
|
+
name: ${EXTERNAL_NETWORK}
|
68
|
+
external: true
|
@@ -5,6 +5,12 @@ module Messaging
|
|
5
5
|
# @return [String] the name of the stream
|
6
6
|
attr_reader :name
|
7
7
|
|
8
|
+
# @return [String] the stream category
|
9
|
+
attr_reader :category
|
10
|
+
|
11
|
+
# @return [String] the stream id
|
12
|
+
attr_reader :id
|
13
|
+
|
8
14
|
# Should not be used directly.
|
9
15
|
# Use {Messaging.stream} or {Store#stream}
|
10
16
|
# @api private
|
@@ -12,12 +18,13 @@ module Messaging
|
|
12
18
|
# @see Store.stream
|
13
19
|
def initialize(name)
|
14
20
|
@name = name
|
21
|
+
@category, @id = name.split('$')
|
15
22
|
end
|
16
23
|
|
17
24
|
# Access to all messages in the stream sorted by stream_position
|
18
25
|
# @return [ActiveRecord::Relation]
|
19
26
|
def messages
|
20
|
-
SerializedMessage.where(
|
27
|
+
SerializedMessage.where(stream_category: category, stream_id: id).order(:stream_position)
|
21
28
|
end
|
22
29
|
|
23
30
|
# The current position of the last message in the stream
|
@@ -18,6 +18,58 @@ module Messaging
|
|
18
18
|
private_class_method :register!
|
19
19
|
|
20
20
|
register!
|
21
|
+
|
22
|
+
def create_schema
|
23
|
+
connection.execute 'CREATE SCHEMA IF NOT EXISTS messaging'
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_id_sequence
|
27
|
+
connection.execute 'CREATE SEQUENCE IF NOT EXISTS messaging.messages_id_seq'
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_messages_table
|
31
|
+
sql = <<~SQL
|
32
|
+
CREATE TABLE messaging.messages (
|
33
|
+
id bigint DEFAULT nextval('messaging.messages_id_seq'::regclass) NOT NULL,
|
34
|
+
uuid uuid NOT NULL,
|
35
|
+
stream character varying NOT NULL,
|
36
|
+
stream_position bigint NOT NULL,
|
37
|
+
message_type character varying NOT NULL,
|
38
|
+
data jsonb,
|
39
|
+
created_at timestamp without time zone NOT NULL,
|
40
|
+
updated_at timestamp without time zone NOT NULL,
|
41
|
+
stream_category character varying,
|
42
|
+
stream_id character varying
|
43
|
+
)
|
44
|
+
PARTITION BY LIST (stream_category);
|
45
|
+
|
46
|
+
CREATE INDEX messages_id_idx ON ONLY messaging.messages USING btree (id);
|
47
|
+
CREATE INDEX messages_stream_category_id_idx ON ONLY messaging.messages USING btree (stream_category, id);
|
48
|
+
CREATE INDEX messages_stream_category_stream_id_stream_position_idx ON ONLY messaging.messages USING btree (stream_category, stream_id, stream_position);
|
49
|
+
SQL
|
50
|
+
connection.execute sql
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_category(category_name)
|
54
|
+
table_name = category_name.parameterize(separator: '_')
|
55
|
+
sql = <<~SQL
|
56
|
+
CREATE TABLE messaging.#{table_name}
|
57
|
+
PARTITION OF messaging.messages FOR VALUES IN ('#{category_name}');
|
58
|
+
SQL
|
59
|
+
connection.execute sql
|
60
|
+
end
|
61
|
+
|
62
|
+
def drop_category(category_name)
|
63
|
+
table_name = category_name.parameterize(separator: '_')
|
64
|
+
sql = <<~SQL
|
65
|
+
drop TABLE messaging.#{table_name}
|
66
|
+
SQL
|
67
|
+
connection.execute sql
|
68
|
+
end
|
69
|
+
|
70
|
+
def connection
|
71
|
+
ActiveRecord::Base.connection
|
72
|
+
end
|
21
73
|
end
|
22
74
|
end
|
23
75
|
end
|
data/lib/messaging/config.rb
CHANGED
@@ -2,56 +2,56 @@ module Messaging
|
|
2
2
|
class Config
|
3
3
|
extend ::Dry::Configurable
|
4
4
|
|
5
|
-
setting :app_name, 'messaging', reader: true
|
5
|
+
setting :app_name, default: 'messaging', reader: true
|
6
6
|
|
7
|
-
setting(:error_handlers, [], reader: true) { |value| Array(value) }
|
7
|
+
setting(:error_handlers, default: [], reader: true) { |value| Array(value) }
|
8
8
|
|
9
|
-
setting :background_job_handler, ->(message, handler_name) { handler_name.constantize.call(message) }, reader: true
|
9
|
+
setting :background_job_handler, default: ->(message, handler_name) { handler_name.constantize.call(message) }, reader: true
|
10
10
|
|
11
|
-
setting :logger, Logger.new(STDOUT), reader: true
|
11
|
+
setting :logger, default: Logger.new(STDOUT), reader: true
|
12
12
|
|
13
13
|
setting :consumer, reader: true do
|
14
|
-
setting :adapter, :kafka
|
15
|
-
setting(:middlewares, []) { |value| Array(value) }
|
14
|
+
setting :adapter, default: :kafka
|
15
|
+
setting(:middlewares, default: []) { |value| Array(value) }
|
16
16
|
end
|
17
17
|
|
18
18
|
setting :dispatcher, reader: true do
|
19
|
-
setting :adapter, :kafka
|
20
|
-
setting(:middlewares, []) { |value| Array(value) }
|
19
|
+
setting :adapter, default: :kafka
|
20
|
+
setting(:middlewares, default: []) { |value| Array(value) }
|
21
21
|
end
|
22
22
|
|
23
23
|
setting :message_store, reader: true do
|
24
|
-
setting :adapter, :postgres
|
25
|
-
setting(:middlewares, []) { |value| Array(value) }
|
24
|
+
setting :adapter, default: :postgres
|
25
|
+
setting(:middlewares, default: []) { |value| Array(value) }
|
26
26
|
end
|
27
27
|
|
28
28
|
setting :kafka, reader: true do
|
29
|
-
setting :log_level, :warn
|
30
|
-
setting :pause_timeout, 10
|
29
|
+
setting :log_level, default: :warn
|
30
|
+
setting :pause_timeout, default: 10
|
31
31
|
|
32
32
|
setting :client do
|
33
|
-
setting :seed_brokers, ['localhost:9092']
|
33
|
+
setting :seed_brokers, default: ['localhost:9092']
|
34
34
|
setting :connect_timeout
|
35
35
|
setting :socket_timeout
|
36
36
|
setting :ssl_ca_certs_from_system
|
37
37
|
setting :sasl_plain_username
|
38
38
|
setting :sasl_plain_password
|
39
|
-
setting :ssl_ca_cert, ENV['KAFKA_SSL_CA']
|
40
|
-
setting :ssl_client_cert, ENV['KAFKA_SSL_CERTIFICATE']
|
41
|
-
setting :ssl_client_cert_key, ENV['KAFKA_SSL_KEY']
|
39
|
+
setting :ssl_ca_cert, default: ENV['KAFKA_SSL_CA']
|
40
|
+
setting :ssl_client_cert, default: ENV['KAFKA_SSL_CERTIFICATE']
|
41
|
+
setting :ssl_client_cert_key, default: ENV['KAFKA_SSL_KEY']
|
42
42
|
end
|
43
43
|
|
44
44
|
setting :consumer do
|
45
|
-
setting :session_timeout, 30
|
46
|
-
setting :offset_commit_interval, 10
|
47
|
-
setting :offset_commit_threshold, 0
|
48
|
-
setting :heartbeat_interval, 10
|
45
|
+
setting :session_timeout, default: 30
|
46
|
+
setting :offset_commit_interval, default: 10
|
47
|
+
setting :offset_commit_threshold, default: 0
|
48
|
+
setting :heartbeat_interval, default: 10
|
49
49
|
end
|
50
50
|
|
51
51
|
setting :producer do
|
52
|
-
setting :max_queue_size, 5_000
|
53
|
-
setting :delivery_threshold, 10
|
54
|
-
setting :delivery_interval, 0.05
|
52
|
+
setting :max_queue_size, default: 5_000
|
53
|
+
setting :delivery_threshold, default: 10
|
54
|
+
setting :delivery_interval, default: 0.05
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/lib/messaging/routes.rb
CHANGED
@@ -51,7 +51,18 @@ module Messaging
|
|
51
51
|
|
52
52
|
# Public: Evaluate route definition.
|
53
53
|
def draw(&block)
|
54
|
-
|
54
|
+
routing_definition_blocks << block
|
55
|
+
end
|
56
|
+
|
57
|
+
def routing_definition_blocks
|
58
|
+
@routing_definition_blocks ||= []
|
59
|
+
end
|
60
|
+
|
61
|
+
def finalize_routes
|
62
|
+
clear_routes!
|
63
|
+
routing_definition_blocks.each do |block|
|
64
|
+
instance_eval(&block)
|
65
|
+
end
|
55
66
|
end
|
56
67
|
|
57
68
|
private
|
data/lib/messaging/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bukowskis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -271,9 +271,10 @@ extensions: []
|
|
271
271
|
extra_rdoc_files: []
|
272
272
|
files:
|
273
273
|
- ".circleci/config.yml"
|
274
|
+
- ".env"
|
274
275
|
- ".gitignore"
|
275
276
|
- ".rspec"
|
276
|
-
-
|
277
|
+
- Dockerfile
|
277
278
|
- Gemfile
|
278
279
|
- Gemfile.lock
|
279
280
|
- README.md
|
@@ -282,7 +283,10 @@ files:
|
|
282
283
|
- _data/navigation.yml
|
283
284
|
- _layouts/single.html
|
284
285
|
- bin/console
|
286
|
+
- bin/de
|
285
287
|
- bin/setup
|
288
|
+
- bin/setup_db
|
289
|
+
- docker-compose.yml
|
286
290
|
- docs/adapters.md
|
287
291
|
- docs/consuming.md
|
288
292
|
- docs/installation.md
|
@@ -351,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
351
355
|
- !ruby/object:Gem::Version
|
352
356
|
version: '0'
|
353
357
|
requirements: []
|
354
|
-
rubygems_version: 3.0.
|
358
|
+
rubygems_version: 3.0.3.1
|
355
359
|
signing_key:
|
356
360
|
specification_version: 4
|
357
361
|
summary: A library for decoupling applications by using messaging to communicate between
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.3.1
|