nulogy_message_bus_producer 3.4.1 → 4.0.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +119 -26
- data/db/migrate/20210330204121_add_event_type_to_subscription_events.rb +9 -0
- data/lib/nulogy_message_bus_producer.rb +17 -0
- data/lib/nulogy_message_bus_producer/subscription_event.rb +3 -0
- data/lib/nulogy_message_bus_producer/version.rb +1 -1
- data/spec/dummy/db/schema.rb +4 -1
- data/spec/dummy/log/development.log +220 -0
- data/spec/dummy/log/test.log +26 -0
- data/spec/integration/lib/nulogy_message_bus_producer/repopulate_replication_slots_spec.rb +3 -1
- data/spec/integration/lib/nulogy_message_bus_producer_spec.rb +25 -0
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef6259b620567209e608c461298813e61646f25f8c7aa5adc10e4fa967069ed6
|
4
|
+
data.tar.gz: 61a9f10a879d6b2b05d25c1b3ad177f23948dcf79dd9a89766df29cc8f1c3bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2b2a6558e97fe79eae7624d8bdaefc585b1a8747cd506cfde6d7757eea01d8f5b7153877efcdbbd424d5d4776a5c79cdfb3a61fdf3144e385a9c2010b7b88b0
|
7
|
+
data.tar.gz: 96f659ac685cef6807855baa4b3a4e633b0340f176fec2ac37dbf6c2cefbf20ec0f2d29a2b74196518cf6ee571bae5f56ffe08117cf86d72197125588ed14f8c
|
data/README.md
CHANGED
@@ -8,13 +8,39 @@ This engine contains the classes and validations for producing messages to the M
|
|
8
8
|
|
9
9
|
1. Add the gem to your Gemfile: `gem "nulogy_message_bus_producer"`
|
10
10
|
2. Install the migrations: `rake railties:install:migrations`
|
11
|
+
3. Use the [Nulogy GraphQL API](https://github.com/nulogy/nulogy_graphql_api)'s schema specs to [ensure schema changes are safe](https://github.com/nulogy/nulogy_graphql_api#schema-generation)
|
11
12
|
|
12
|
-
##
|
13
|
+
## Overview
|
13
14
|
|
14
|
-
|
15
|
+
The Producer gem supports two ways of producing messages:
|
16
|
+
|
17
|
+
### Subscription
|
18
|
+
|
19
|
+
A subscription (either self-serve or configured) is triggered via a domain event.
|
20
|
+
The subscription `event_data` (TODO: column should also be renamed) will render the query against a public GraphQL Schema.
|
21
|
+
|
22
|
+
### Publication
|
23
|
+
|
24
|
+
aka the pub half of `pubsub`.
|
25
|
+
|
26
|
+
A client publishes arbitrary `event_data` (serializable to JSON) to a `topic` under a `event_type`.
|
27
|
+
|
28
|
+
### Comparison
|
29
|
+
|
30
|
+
| Attribute | Subscription | Publication |
|
31
|
+
|-----------------------|------------------------------------------------------|--------------------------|
|
32
|
+
| subscription_id | consumer supplied | random |
|
33
|
+
| subscription_group_id | consumer supplied | random |
|
34
|
+
| topic | consumer supplied | explicit (user supplied) |
|
35
|
+
| type | computed (domain event / GraphQL subscription field) | explicit (user supplied) |
|
36
|
+
| message ordering | per `company_uuid` per `subscription_group_id` | per `company_uuid` |
|
37
|
+
|
38
|
+
## Usage
|
15
39
|
|
16
40
|
### Subscriptions
|
17
41
|
|
42
|
+
Subscriptions should inherit from `NulogyMessageBusProducer::BaseSubscription`.
|
43
|
+
|
18
44
|
Subscriptions are created by consumers to subscribe to certain events that the producer exposes.
|
19
45
|
|
20
46
|
When an event is fired/triggered, subscriptions are used to generate events into the
|
@@ -24,6 +50,31 @@ Debezium then reads this table from the PG replication log and pushes them into
|
|
24
50
|
|
25
51
|
There are two ways to create subscriptions:
|
26
52
|
|
53
|
+
#### Configured
|
54
|
+
|
55
|
+
Subscriptions provided by configuration in the producer app:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
NulogyMessageBusProducer.configure do |c|
|
59
|
+
c.register_schema(schema: "ExampleDomain::Schema", key: "exampleDomain")
|
60
|
+
|
61
|
+
c.add_subscription!(
|
62
|
+
schema: "ExampleDomain::Schema",
|
63
|
+
query: <<~QUERY
|
64
|
+
subscription {
|
65
|
+
domainEvent(subscriptionId: "uuid", subscriptionGroupId: "uuid2", topicName: "consumer-inbox") {
|
66
|
+
domainObject {
|
67
|
+
field
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
QUERY
|
72
|
+
)
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
76
|
+
These subscriptions are stored in the producer and require a deploy to update.
|
77
|
+
|
27
78
|
#### Self-Serve (deprecated)
|
28
79
|
|
29
80
|
You create these subscriptions via the public GraphQL API. e.g.
|
@@ -45,29 +96,70 @@ This style of subscriptions may be removed in a future release.
|
|
45
96
|
|
46
97
|
There is a [guide to migrate from Self-Serve to Configured](docs/self_serve_to_configured_subscriptions.md)
|
47
98
|
|
48
|
-
|
99
|
+
### Publications
|
49
100
|
|
50
|
-
|
101
|
+
The Message Bus has a unified `SubscriptionEvent` (TODO: rename) data structure that will create a Kafka message.
|
102
|
+
Thus, the publication-style of producing messages must provide any required fields to produce a valid `SubscriptionEvent`.
|
51
103
|
|
52
104
|
```ruby
|
53
|
-
|
54
|
-
|
105
|
+
# publish
|
106
|
+
# NulogyMessageBusProducer.publish(topic:, type:, company_uuid:, data:)
|
107
|
+
|
108
|
+
NulogyMessageBusProducer.publish(
|
109
|
+
topic: "some-target-inbox",
|
110
|
+
type: "some-event-type",
|
111
|
+
company_uuid: company.uuid,
|
112
|
+
data: {message: "some data", value: "3", ...}
|
113
|
+
)
|
114
|
+
```
|
55
115
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
116
|
+
Note that we do not support publishing to multiple topics at the moment.
|
117
|
+
|
118
|
+
A producer may want to wrap these methods:
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
class MetricsPublisher
|
122
|
+
def initialize(company, type: "some-kind-of-metric", topic: "metrics-stream")
|
123
|
+
@company_uuid = company.uuid
|
124
|
+
@topic = topic
|
125
|
+
@type = type
|
126
|
+
end
|
127
|
+
|
128
|
+
def publish(data)
|
129
|
+
NulogyMessageBusProducer.publish(
|
130
|
+
topic: @topic,
|
131
|
+
type: @type,
|
132
|
+
company_uuid: @company_uuid,
|
133
|
+
data: {message:"something", value: 3}
|
134
|
+
)
|
135
|
+
end
|
68
136
|
end
|
137
|
+
|
138
|
+
MetricsPublisher.new(Current.company).publish(metric_data)
|
69
139
|
```
|
70
140
|
|
141
|
+
#### Self-Serve (soft-deprecated)
|
142
|
+
|
143
|
+
You create these subscriptions via the public GraphQL API. For testing, the [Insomnia](https://insomnia.rest/) client
|
144
|
+
is highly recommended.
|
145
|
+
|
146
|
+
```graphql
|
147
|
+
subscription {
|
148
|
+
workOrderUpdated(subscriptionId: "uuid", subscriptionGroupId: "uuid", topicName: "some-topic") {
|
149
|
+
workOrder {
|
150
|
+
id
|
151
|
+
code
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
```
|
156
|
+
|
157
|
+
These subscriptions are written to the `NulogyMessageBusProducer.subscriptions_table_name` table.
|
158
|
+
|
159
|
+
This style of subscriptions may be removed in a future release.
|
160
|
+
|
161
|
+
There is a [guide to migrate from Self-Serve to Configured](docs/self_serve_to_configured_subscriptions.md)
|
162
|
+
|
71
163
|
## Configuration
|
72
164
|
|
73
165
|
| Configuration | Default | Description |
|
@@ -261,19 +353,20 @@ rails message_bus_producer:repopulate_replication_slots
|
|
261
353
|
|
262
354
|
## Rake Tasks
|
263
355
|
|
264
|
-
| Rake command
|
265
|
-
|
266
|
-
| (default)
|
267
|
-
| `spec`
|
268
|
-
| `
|
356
|
+
| Rake command | Description |
|
357
|
+
|------------------|------------------|
|
358
|
+
| (default) | RSpec + Standard |
|
359
|
+
| `spec` | RSpec |
|
360
|
+
| `standardrb` | Standard |
|
361
|
+
| `standardrb:fix` | Fix to Standard |
|
269
362
|
|
270
363
|
# Gem Development Setup
|
271
364
|
|
272
365
|
If you are doing work on this gem you will want to:
|
273
366
|
```shell script
|
274
367
|
docker-compose up
|
275
|
-
rake db:setup
|
276
|
-
rake
|
368
|
+
bundle exec rake db:setup
|
369
|
+
bundle exec rake
|
277
370
|
```
|
278
371
|
|
279
372
|
# Gem Releases
|
@@ -285,4 +378,4 @@ You must be listed as a gem owner [on rubygems](https://rubygems.org/gems/nulogy
|
|
285
378
|
* Update `lib/nulogy_message_bus_producer/version.rb`
|
286
379
|
* Run `bundle install`
|
287
380
|
* Update the CHANGELOG
|
288
|
-
* Run `rake release`
|
381
|
+
* Run `bundle exec rake release`
|
@@ -34,6 +34,23 @@ module NulogyMessageBusProducer
|
|
34
34
|
config.context_for_subscription(subscription)
|
35
35
|
end
|
36
36
|
|
37
|
+
def self.register_publication
|
38
|
+
raise "not implemented yet"
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.publish(topic:, type:, company_uuid:, data:)
|
42
|
+
SubscriptionEvent.create_or_update(
|
43
|
+
id: SecureRandom.uuid,
|
44
|
+
subscription_id: SecureRandom.uuid,
|
45
|
+
partition_key: company_uuid,
|
46
|
+
|
47
|
+
company_uuid: company_uuid,
|
48
|
+
event_type: type,
|
49
|
+
event_json: data,
|
50
|
+
topic_name: topic
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
37
54
|
def self.trigger_event(schema, event_type, root_object)
|
38
55
|
schema_key = NulogyMessageBusProducer.resolve_schema_key(schema)
|
39
56
|
subscriptions = Subscriptions::Finder.new(config).for_schema_event(schema_key, event_type)
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module NulogyMessageBusProducer
|
2
2
|
# A model that contains the event data for a particular subscription
|
3
3
|
# It is simply saved in the database and shipped to Kafka by Debezium
|
4
|
+
# TODO: rename this --- can be from a subscription or publication
|
5
|
+
# Message? -- kinda conflicts with a "kafka message" but that is on the consumer side.
|
4
6
|
class SubscriptionEvent < ApplicationRecord
|
5
7
|
self.table_name = :message_bus_subscription_events
|
6
8
|
|
9
|
+
# TODO: this should be renamed. You can't update an Event.
|
7
10
|
def self.create_or_update(attrs)
|
8
11
|
find_or_initialize_by(id: attrs[:id]).tap do |model|
|
9
12
|
model.update!(attrs)
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2021_03_30_204121) do
|
14
|
+
|
14
15
|
# These are extensions that must be enabled in order to support this database
|
15
16
|
enable_extension "plpgsql"
|
16
17
|
enable_extension "uuid-ossp"
|
@@ -22,6 +23,7 @@ ActiveRecord::Schema.define(version: 2020_10_05_164116) do
|
|
22
23
|
t.uuid "company_uuid", null: false
|
23
24
|
t.json "event_json", null: false
|
24
25
|
t.datetime "created_at"
|
26
|
+
t.text "event_type"
|
25
27
|
t.index ["created_at"], name: "index_nulogy_mb_producer_subscription_events_on_created_at"
|
26
28
|
end
|
27
29
|
|
@@ -35,4 +37,5 @@ ActiveRecord::Schema.define(version: 2020_10_05_164116) do
|
|
35
37
|
t.datetime "updated_at", null: false
|
36
38
|
t.index ["event_type"], name: "index_nulogy_mb_producer_subscriptions_on_event_type"
|
37
39
|
end
|
40
|
+
|
38
41
|
end
|
@@ -2331,3 +2331,223 @@ Migrating to CreateActiveStorageTables (20201005164116)
|
|
2331
2331
|
[1m[36mActiveRecord::InternalMetadata Update (1.2ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2021-03-09 17:25:53.533488"], ["key", "environment"]]
|
2332
2332
|
[1m[35m (1.6ms)[0m [1m[35mCOMMIT[0m
|
2333
2333
|
[1m[35m (1.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2334
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2335
|
+
[1m[35m (5.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2336
|
+
Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
|
2337
|
+
[1m[35m (2.0ms)[0m [1m[35mBEGIN[0m
|
2338
|
+
[1m[35m (8.7ms)[0m [1m[35mALTER TABLE "message_bus_subscriptions" ADD "event_type" text[0m
|
2339
|
+
[1m[35m (2.0ms)[0m [1m[31mROLLBACK[0m
|
2340
|
+
[1m[35m (2.1ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2341
|
+
[1m[35m (1.9ms)[0m [1m[35mCREATE DATABASE "nulogy_message_bus_producer_development" ENCODING = 'utf8'[0m
|
2342
|
+
[1m[35m (1.8ms)[0m [1m[35mCREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'[0m
|
2343
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2344
|
+
[1m[35m (3.0ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2345
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2346
|
+
[1m[35m (1.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2347
|
+
[1m[35m (1.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2348
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2349
|
+
[1m[35mSQL (3.8ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
2350
|
+
[1m[35mSQL (1.6ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "uuid-ossp"[0m
|
2351
|
+
[1m[35m (8.9ms)[0m [1m[35mDROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE[0m
|
2352
|
+
[1m[35m (21.9ms)[0m [1m[35mCREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)[0m
|
2353
|
+
[1m[35m (4.3ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")[0m
|
2354
|
+
[1m[35m (3.0ms)[0m [1m[35mDROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE[0m
|
2355
|
+
[1m[35m (6.1ms)[0m [1m[35mCREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
2356
|
+
[1m[35m (3.6ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")[0m
|
2357
|
+
[1m[35m (2.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2358
|
+
[1m[36mActiveRecord::InternalMetadata Load (1.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2359
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2360
|
+
[1m[35m (1.6ms)[0m [1m[35mCOMMIT[0m
|
2361
|
+
[1m[36mActiveRecord::InternalMetadata Load (1.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2362
|
+
[1m[35m (1.7ms)[0m [1m[35mBEGIN[0m
|
2363
|
+
[1m[35m (1.4ms)[0m [1m[35mCOMMIT[0m
|
2364
|
+
[1m[35mSQL (4.3ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
2365
|
+
[1m[35mSQL (2.1ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "uuid-ossp"[0m
|
2366
|
+
[1m[35m (16.8ms)[0m [1m[35mDROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE[0m
|
2367
|
+
[1m[35m (22.6ms)[0m [1m[35mCREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)[0m
|
2368
|
+
[1m[35m (4.5ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")[0m
|
2369
|
+
[1m[35m (4.2ms)[0m [1m[35mDROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE[0m
|
2370
|
+
[1m[35m (8.6ms)[0m [1m[35mCREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
2371
|
+
[1m[35m (4.1ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")[0m
|
2372
|
+
[1m[35m (3.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2373
|
+
[1m[35m (5.9ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20201005164116)[0m
|
2374
|
+
[1m[35m (3.0ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
|
2375
|
+
(20200611150212),
|
2376
|
+
(20201005150212);
|
2377
|
+
|
2378
|
+
[0m
|
2379
|
+
[1m[36mActiveRecord::InternalMetadata Load (3.1ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2380
|
+
[1m[35m (2.0ms)[0m [1m[35mBEGIN[0m
|
2381
|
+
[1m[36mActiveRecord::InternalMetadata Create (3.6ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2021-03-30 20:52:23.588828"], ["updated_at", "2021-03-30 20:52:23.588828"]]
|
2382
|
+
[1m[35m (3.0ms)[0m [1m[35mCOMMIT[0m
|
2383
|
+
[1m[36mActiveRecord::InternalMetadata Load (2.0ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2384
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2385
|
+
[1m[36mActiveRecord::InternalMetadata Update (1.8ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2021-03-30 20:52:23.604948"], ["key", "environment"]]
|
2386
|
+
[1m[35m (2.3ms)[0m [1m[35mCOMMIT[0m
|
2387
|
+
[1m[35m (2.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2388
|
+
[1m[35m (1.1ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2389
|
+
[1m[35m (2.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2390
|
+
Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
|
2391
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2392
|
+
[1m[35m (2.8ms)[0m [1m[35mALTER TABLE "message_bus_subscriptions" ADD "event_type" text[0m
|
2393
|
+
[1m[35m (1.6ms)[0m [1m[31mROLLBACK[0m
|
2394
|
+
[1m[35m (1.6ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2395
|
+
[1m[35m (1.5ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2396
|
+
[1m[35m (2.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2397
|
+
Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
|
2398
|
+
[1m[35m (1.6ms)[0m [1m[35mBEGIN[0m
|
2399
|
+
[1m[35m (3.1ms)[0m [1m[35mALTER TABLE "message_bus_subscriptions" ADD "event_type" text[0m
|
2400
|
+
[1m[35m (1.6ms)[0m [1m[31mROLLBACK[0m
|
2401
|
+
[1m[35m (2.4ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2402
|
+
[1m[35m (2.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2403
|
+
[1m[35m (1.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2404
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2405
|
+
[1m[35m (1.2ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2406
|
+
[1m[35m (1.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2407
|
+
Migrating to CreateActiveStorageTables (20201005164116)
|
2408
|
+
[1m[35m (1.2ms)[0m [1m[35mBEGIN[0m
|
2409
|
+
[1m[36mActiveRecord::SchemaMigration Destroy (2.7ms)[0m [1m[31mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1[0m [["version", "20201005164116"]]
|
2410
|
+
[1m[35m (5.3ms)[0m [1m[35mCOMMIT[0m
|
2411
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2412
|
+
[1m[35m (1.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2413
|
+
[1m[35m (1.1ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2414
|
+
[1m[35m (2.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2415
|
+
Migrating to CreateActiveStorageTables (20201005164116)
|
2416
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2417
|
+
[1m[36mActiveRecord::SchemaMigration Create (1.7ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20201005164116"]]
|
2418
|
+
[1m[35m (2.7ms)[0m [1m[35mCOMMIT[0m
|
2419
|
+
Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
|
2420
|
+
[1m[35m (1.7ms)[0m [1m[35mBEGIN[0m
|
2421
|
+
[1m[35m (3.3ms)[0m [1m[35mALTER TABLE "message_bus_subscriptions" ADD "event_type" text[0m
|
2422
|
+
[1m[35m (1.5ms)[0m [1m[31mROLLBACK[0m
|
2423
|
+
[1m[35m (1.5ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2424
|
+
[1m[35m (2.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2425
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2426
|
+
[1m[35m (1.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2427
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2428
|
+
[1m[35m (1.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2429
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2430
|
+
[1m[35m (24.4ms)[0m [1m[35mDROP DATABASE IF EXISTS "nulogy_message_bus_producer_development"[0m
|
2431
|
+
[1m[35m (1.8ms)[0m [1m[35mDROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"[0m
|
2432
|
+
[1m[35m (248.6ms)[0m [1m[35mCREATE DATABASE "nulogy_message_bus_producer_development" ENCODING = 'utf8'[0m
|
2433
|
+
[1m[35m (1.9ms)[0m [1m[35mCREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'[0m
|
2434
|
+
[1m[35m (16.4ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
2435
|
+
[1m[35m (10.8ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
2436
|
+
[1m[35m (1.3ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2437
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2438
|
+
Migrating to CreatePublicSubscriptionsAndEventsTables (20200611150212)
|
2439
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2440
|
+
[1m[35mSQL (7.7ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "uuid-ossp"[0m
|
2441
|
+
[1m[35m (6.6ms)[0m [1m[35mCREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
2442
|
+
[1m[35m (3.3ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")[0m
|
2443
|
+
[1m[35m (5.9ms)[0m [1m[35mCREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "public_subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "tenant_id" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp)[0m
|
2444
|
+
[1m[35m (3.2ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")[0m
|
2445
|
+
[1m[36mActiveRecord::SchemaMigration Create (2.0ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20200611150212"]]
|
2446
|
+
[1m[35m (2.9ms)[0m [1m[35mCOMMIT[0m
|
2447
|
+
Migrating to RenameTenantIdAndPublic (20201005150212)
|
2448
|
+
[1m[35m (1.2ms)[0m [1m[35mBEGIN[0m
|
2449
|
+
[1m[35m (2.3ms)[0m [1m[35mALTER TABLE "message_bus_subscription_events" RENAME COLUMN "tenant_id" TO "company_uuid"[0m
|
2450
|
+
[1m[35m (1.5ms)[0m [1m[35mALTER TABLE "message_bus_subscription_events" RENAME COLUMN "public_subscription_id" TO "subscription_id"[0m
|
2451
|
+
[1m[36mActiveRecord::SchemaMigration Create (1.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20201005150212"]]
|
2452
|
+
[1m[35m (1.8ms)[0m [1m[35mCOMMIT[0m
|
2453
|
+
Migrating to CreateActiveStorageTables (20201005164116)
|
2454
|
+
[1m[35m (1.4ms)[0m [1m[35mBEGIN[0m
|
2455
|
+
[1m[36mActiveRecord::SchemaMigration Create (1.4ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20201005164116"]]
|
2456
|
+
[1m[35m (1.8ms)[0m [1m[35mCOMMIT[0m
|
2457
|
+
Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
|
2458
|
+
[1m[35m (1.9ms)[0m [1m[35mBEGIN[0m
|
2459
|
+
[1m[35m (2.2ms)[0m [1m[35mALTER TABLE "message_bus_subscriptions" ADD "event_type" text[0m
|
2460
|
+
[1m[35m (1.3ms)[0m [1m[31mROLLBACK[0m
|
2461
|
+
[1m[35m (1.6ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2462
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT pg_try_advisory_lock(3053653019973222135)[0m
|
2463
|
+
[1m[35m (2.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2464
|
+
Migrating to AddEventTypeToSubscriptionEvents (20210330204121)
|
2465
|
+
[1m[35m (1.7ms)[0m [1m[35mBEGIN[0m
|
2466
|
+
[1m[35m (2.3ms)[0m [1m[35mALTER TABLE "message_bus_subscription_events" ADD "event_type" text[0m
|
2467
|
+
[1m[36mActiveRecord::SchemaMigration Create (2.1ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20210330204121"]]
|
2468
|
+
[1m[35m (2.3ms)[0m [1m[35mCOMMIT[0m
|
2469
|
+
[1m[36mActiveRecord::InternalMetadata Load (2.0ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2470
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2471
|
+
[1m[36mActiveRecord::InternalMetadata Create (2.8ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2021-03-31 14:32:42.969683"], ["updated_at", "2021-03-31 14:32:42.969683"]]
|
2472
|
+
[1m[35m (1.8ms)[0m [1m[35mCOMMIT[0m
|
2473
|
+
[1m[35m (1.2ms)[0m [1m[34mSELECT pg_advisory_unlock(3053653019973222135)[0m
|
2474
|
+
[1m[35m (1.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2475
|
+
[1m[35m (4.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2476
|
+
[1m[35m (4.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2477
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2478
|
+
[1m[35m (1.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2479
|
+
[1m[35m (1.6ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2480
|
+
[1m[35m (1.1ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2481
|
+
[1m[35m (3.0ms)[0m [1m[35mDROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"[0m
|
2482
|
+
[1m[35m (2.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2483
|
+
[1m[35m (1.8ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2484
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2485
|
+
[1m[35m (1.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2486
|
+
[1m[35m (1.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2487
|
+
[1m[35m (1.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2488
|
+
[1m[35m (1.9ms)[0m [1m[35mDROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"[0m
|
2489
|
+
[1m[35m (5.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2490
|
+
[1m[35m (4.5ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2491
|
+
[1m[35m (1.8ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2492
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2493
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2494
|
+
[1m[35m (1.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2495
|
+
[1m[35m (3.0ms)[0m [1m[35mDROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"[0m
|
2496
|
+
[1m[35m (4.0ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2497
|
+
[1m[35m (2.8ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2498
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2499
|
+
[1m[35m (1.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2500
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2501
|
+
[1m[35m (2.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", "environment"]]
|
2502
|
+
[1m[35m (23.2ms)[0m [1m[35mDROP DATABASE IF EXISTS "nulogy_message_bus_producer_test"[0m
|
2503
|
+
[1m[35m (223.2ms)[0m [1m[35mCREATE DATABASE "nulogy_message_bus_producer_test" ENCODING = 'utf8'[0m
|
2504
|
+
[1m[35mSQL (1.4ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
2505
|
+
[1m[35mSQL (7.9ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "uuid-ossp"[0m
|
2506
|
+
[1m[35m (1.6ms)[0m [1m[35mDROP TABLE IF EXISTS "message_bus_subscription_events" CASCADE[0m
|
2507
|
+
[1m[35m (8.8ms)[0m [1m[35mCREATE TABLE "message_bus_subscription_events" ("id" uuid NOT NULL PRIMARY KEY, "subscription_id" uuid NOT NULL, "partition_key" character varying NOT NULL, "topic_name" character varying NOT NULL, "company_uuid" uuid NOT NULL, "event_json" json NOT NULL, "created_at" timestamp, "event_type" text)[0m
|
2508
|
+
[1m[35m (3.8ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscription_events_on_created_at" ON "message_bus_subscription_events" ("created_at")[0m
|
2509
|
+
[1m[35m (1.4ms)[0m [1m[35mDROP TABLE IF EXISTS "message_bus_subscriptions" CASCADE[0m
|
2510
|
+
[1m[35m (5.9ms)[0m [1m[35mCREATE TABLE "message_bus_subscriptions" ("id" uuid NOT NULL PRIMARY KEY, "subscription_group_id" uuid NOT NULL, "event_type" character varying NOT NULL, "topic_name" character varying NOT NULL, "query" character varying NOT NULL, "schema_key" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
2511
|
+
[1m[35m (3.8ms)[0m [1m[35mCREATE INDEX "index_nulogy_mb_producer_subscriptions_on_event_type" ON "message_bus_subscriptions" ("event_type")[0m
|
2512
|
+
[1m[35m (6.2ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)[0m
|
2513
|
+
[1m[35m (1.7ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
2514
|
+
[1m[35m (1.9ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES (20210330204121)[0m
|
2515
|
+
[1m[35m (2.2ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES
|
2516
|
+
(20201005164116),
|
2517
|
+
(20200611150212),
|
2518
|
+
(20201005150212);
|
2519
|
+
|
2520
|
+
[0m
|
2521
|
+
[1m[35m (6.0ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
2522
|
+
[1m[36mActiveRecord::InternalMetadata Load (2.0ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2523
|
+
[1m[35m (1.4ms)[0m [1m[35mBEGIN[0m
|
2524
|
+
[1m[36mActiveRecord::InternalMetadata Create (1.6ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "development"], ["created_at", "2021-03-31 17:26:56.186267"], ["updated_at", "2021-03-31 17:26:56.186267"]]
|
2525
|
+
[1m[35m (1.8ms)[0m [1m[35mCOMMIT[0m
|
2526
|
+
[1m[36mActiveRecord::InternalMetadata Load (1.4ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", "environment"], ["LIMIT", 1]]
|
2527
|
+
[1m[35m (1.3ms)[0m [1m[35mBEGIN[0m
|
2528
|
+
[1m[36mActiveRecord::InternalMetadata Update (1.5ms)[0m [1m[33mUPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3[0m [["value", "test"], ["updated_at", "2021-03-31 17:26:56.197348"], ["key", "environment"]]
|
2529
|
+
[1m[35m (1.7ms)[0m [1m[35mCOMMIT[0m
|
2530
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (3.6ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "052ccd7d-fcb8-4779-a431-edcd07c6f9f2"], ["LIMIT", 1]]
|
2531
|
+
[1m[35m (1.5ms)[0m [1m[35mBEGIN[0m
|
2532
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (2.1ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "052ccd7d-fcb8-4779-a431-edcd07c6f9f2"], ["subscription_id", "b7431c4b-6ba1-48de-9089-0d551a0b2289"], ["partition_key", "d42fd0ff-5f7c-4479-a555-275ad4a3d9ba"], ["topic_name", "some-topic"], ["company_uuid", "d42fd0ff-5f7c-4479-a555-275ad4a3d9ba"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:13:57.002078"], ["event_type", "some-type"]]
|
2533
|
+
[1m[35m (2.9ms)[0m [1m[35mCOMMIT[0m
|
2534
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (2.9ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "4301a9a9-410d-4906-a308-3f2e2a716481"], ["LIMIT", 1]]
|
2535
|
+
[1m[35m (1.9ms)[0m [1m[35mBEGIN[0m
|
2536
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (1.9ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "4301a9a9-410d-4906-a308-3f2e2a716481"], ["subscription_id", "af99e3c4-e8da-4650-8429-a093d57e28c5"], ["partition_key", "43c04d27-3b88-4bb8-aa32-6e9cc401a9a1"], ["topic_name", "some-topic"], ["company_uuid", "43c04d27-3b88-4bb8-aa32-6e9cc401a9a1"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:20:17.588245"], ["event_type", "some-type"]]
|
2537
|
+
[1m[35m (2.9ms)[0m [1m[35mCOMMIT[0m
|
2538
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (2.4ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "0de39387-eb7b-4c82-981e-5440bcb563b0"], ["LIMIT", 1]]
|
2539
|
+
[1m[35m (1.7ms)[0m [1m[35mBEGIN[0m
|
2540
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (2.1ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "0de39387-eb7b-4c82-981e-5440bcb563b0"], ["subscription_id", "9d1b70b1-7598-4687-a634-d55b17f868cc"], ["partition_key", "c7075533-fd2e-4f63-b964-980f3fa5f4a6"], ["topic_name", "some-topic"], ["company_uuid", "c7075533-fd2e-4f63-b964-980f3fa5f4a6"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:19.585687"], ["event_type", "some-type"]]
|
2541
|
+
[1m[35m (2.9ms)[0m [1m[35mCOMMIT[0m
|
2542
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (2.6ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "afa71c73-ea8c-4c05-ab56-5518923ef09f"], ["LIMIT", 1]]
|
2543
|
+
[1m[35m (1.6ms)[0m [1m[35mBEGIN[0m
|
2544
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (2.1ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "afa71c73-ea8c-4c05-ab56-5518923ef09f"], ["subscription_id", "a91d295d-d570-49fc-bb50-7bc2317e7635"], ["partition_key", "106bea13-ccdb-49a5-a613-9c3e206267ca"], ["topic_name", "some-topic"], ["company_uuid", "106bea13-ccdb-49a5-a613-9c3e206267ca"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:20.593447"], ["event_type", "some-type"]]
|
2545
|
+
[1m[35m (3.1ms)[0m [1m[35mCOMMIT[0m
|
2546
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (2.3ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "91cc1302-d68e-42e4-8491-d4743289c54a"], ["LIMIT", 1]]
|
2547
|
+
[1m[35m (1.7ms)[0m [1m[35mBEGIN[0m
|
2548
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (1.9ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "91cc1302-d68e-42e4-8491-d4743289c54a"], ["subscription_id", "d820eb79-29b4-48cb-91d3-aa6deeb7b182"], ["partition_key", "67afaf53-d2b3-47cd-937b-6d4ef9492b39"], ["topic_name", "some-topic"], ["company_uuid", "67afaf53-d2b3-47cd-937b-6d4ef9492b39"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:21.425429"], ["event_type", "some-type"]]
|
2549
|
+
[1m[35m (3.0ms)[0m [1m[35mCOMMIT[0m
|
2550
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (2.2ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "31e9b591-c646-4fcc-bcc6-70afe4aaa05c"], ["LIMIT", 1]]
|
2551
|
+
[1m[35m (1.3ms)[0m [1m[35mBEGIN[0m
|
2552
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (1.3ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "31e9b591-c646-4fcc-bcc6-70afe4aaa05c"], ["subscription_id", "8e8b156e-b4e5-47a7-9f86-e6e876ccaf51"], ["partition_key", "c035daf9-1d15-4515-bbe2-7170a1ed7402"], ["topic_name", "some-topic"], ["company_uuid", "c035daf9-1d15-4515-bbe2-7170a1ed7402"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 18:21:22.409136"], ["event_type", "some-type"]]
|
2553
|
+
[1m[35m (1.8ms)[0m [1m[35mCOMMIT[0m
|
data/spec/dummy/log/test.log
CHANGED
@@ -46608,3 +46608,29 @@ COMMIT;
|
|
46608
46608
|
[1m[35m (2.0ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
46609
46609
|
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (1.6ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."subscription_id" = $1 LIMIT $2[0m [["subscription_id", "629c7f67-2a11-4822-9a24-e61030d229c9"], ["LIMIT", 1]]
|
46610
46610
|
[1m[35m (1.9ms)[0m [1m[31mROLLBACK[0m
|
46611
|
+
[1m[35m (1.0ms)[0m [1m[35mBEGIN[0m
|
46612
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (4.9ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "8ce5a391-d750-415b-9c81-70f2cc18c5e4"], ["LIMIT", 1]]
|
46613
|
+
[1m[35m (2.0ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
46614
|
+
[1m[35m (1.8ms)[0m [1m[31mROLLBACK TO SAVEPOINT active_record_1[0m
|
46615
|
+
[1m[35m (1.7ms)[0m [1m[31mROLLBACK[0m
|
46616
|
+
[1m[35m (2.0ms)[0m [1m[35mBEGIN[0m
|
46617
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (1.9ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "3021b411-c2a5-48c0-9e08-a941ed714ce9"], ["LIMIT", 1]]
|
46618
|
+
[1m[35m (2.3ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
46619
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (3.9ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "3021b411-c2a5-48c0-9e08-a941ed714ce9"], ["subscription_id", "e03f0e3e-9c62-408b-906a-2a1469a0460c"], ["partition_key", "8eb1ab0b-dfaa-43ff-8995-266807bd8b0a"], ["topic_name", "some-topic"], ["company_uuid", "9dc238f9-3c1a-40ac-b6b8-8f8db06c62d2"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 17:27:05.849975"], ["event_type", "some-type"]]
|
46620
|
+
[1m[35m (1.6ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
46621
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (1.9ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" ORDER BY "message_bus_subscription_events"."id" DESC LIMIT $1[0m [["LIMIT", 1]]
|
46622
|
+
[1m[35m (2.4ms)[0m [1m[31mROLLBACK[0m
|
46623
|
+
[1m[35m (1.3ms)[0m [1m[35mBEGIN[0m
|
46624
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (1.7ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "6feda3d0-0a0e-4e9a-8e82-40a5b05e9335"], ["LIMIT", 1]]
|
46625
|
+
[1m[35m (2.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
46626
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (2.0ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "6feda3d0-0a0e-4e9a-8e82-40a5b05e9335"], ["subscription_id", "13b956c1-122c-4949-a25c-1e81fad604b8"], ["partition_key", "cf83b600-b5b4-4483-aa35-2cc7e375ee0c"], ["topic_name", "some-topic"], ["company_uuid", "260e85ba-696b-489f-a3b7-229aed9af3e5"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 17:27:28.657359"], ["event_type", "some-type"]]
|
46627
|
+
[1m[35m (1.5ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
46628
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (1.5ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" ORDER BY "message_bus_subscription_events"."id" DESC LIMIT $1[0m [["LIMIT", 1]]
|
46629
|
+
[1m[35m (1.7ms)[0m [1m[31mROLLBACK[0m
|
46630
|
+
[1m[35m (1.2ms)[0m [1m[35mBEGIN[0m
|
46631
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (2.1ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" WHERE "message_bus_subscription_events"."id" = $1 LIMIT $2[0m [["id", "fdb612fd-ff7e-4d1b-9f47-a976eaf55de7"], ["LIMIT", 1]]
|
46632
|
+
[1m[35m (1.5ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
46633
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Create (1.9ms)[0m [1m[32mINSERT INTO "message_bus_subscription_events" ("id", "subscription_id", "partition_key", "topic_name", "company_uuid", "event_json", "created_at", "event_type") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"[0m [["id", "fdb612fd-ff7e-4d1b-9f47-a976eaf55de7"], ["subscription_id", "371f45eb-c140-454c-a8c3-efc4736e7658"], ["partition_key", "c9e8ebdb-d03f-45cc-97e3-c3ddd1913548"], ["topic_name", "some-topic"], ["company_uuid", "e9a1bffb-bd56-458c-a29c-d0d9aa99d783"], ["event_json", "{\"field\":\"value\"}"], ["created_at", "2021-03-31 17:27:39.991197"], ["event_type", "some-type"]]
|
46634
|
+
[1m[35m (1.4ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
46635
|
+
[1m[36mNulogyMessageBusProducer::SubscriptionEvent Load (1.3ms)[0m [1m[34mSELECT "message_bus_subscription_events".* FROM "message_bus_subscription_events" ORDER BY "message_bus_subscription_events"."id" DESC LIMIT $1[0m [["LIMIT", 1]]
|
46636
|
+
[1m[35m (2.1ms)[0m [1m[31mROLLBACK[0m
|
@@ -14,7 +14,9 @@ RSpec.describe NulogyMessageBusProducer::RepopulateReplicationSlots do
|
|
14
14
|
cleanup_everything
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
# TODO: This test is incredibly flakey.
|
18
|
+
# It rarely works in CI, and ocassionally works locally.
|
19
|
+
xit "generates events" do
|
18
20
|
Kafka.create_topic(topic_name)
|
19
21
|
consumer = Kafka.setup_kafka_consumer(topic_name)
|
20
22
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "integration_spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe NulogyMessageBusProducer do
|
4
|
+
describe "publishing events" do
|
5
|
+
it "publishes an event" do
|
6
|
+
company_uuid = SecureRandom.uuid
|
7
|
+
|
8
|
+
described_class.publish(
|
9
|
+
topic: "some-topic",
|
10
|
+
type: "some-type",
|
11
|
+
company_uuid: company_uuid,
|
12
|
+
data: {
|
13
|
+
field: "value"
|
14
|
+
}
|
15
|
+
)
|
16
|
+
|
17
|
+
message = NulogyMessageBusProducer::SubscriptionEvent.last
|
18
|
+
|
19
|
+
expect(message).to be_present
|
20
|
+
expect(message.topic_name).to eq("some-topic")
|
21
|
+
expect(message.company_uuid).to eq(company_uuid)
|
22
|
+
expect(message.event_json).to eq({"field" => "value"})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nulogy_message_bus_producer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nulogy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- Rakefile
|
218
218
|
- db/migrate/20200611150212_create_public_subscriptions_and_events_tables.rb
|
219
219
|
- db/migrate/20201005150212_rename_tenant_id_and_public.rb
|
220
|
+
- db/migrate/20210330204121_add_event_type_to_subscription_events.rb
|
220
221
|
- lib/nulogy_message_bus_producer.rb
|
221
222
|
- lib/nulogy_message_bus_producer/application_record.rb
|
222
223
|
- lib/nulogy_message_bus_producer/base_subscription.rb
|
@@ -298,6 +299,7 @@ files:
|
|
298
299
|
- spec/integration/lib/nulogy_message_bus_producer/subscriptions/postgres_transport_spec.rb
|
299
300
|
- spec/integration/lib/nulogy_message_bus_producer/subscriptions/query_validator_spec.rb
|
300
301
|
- spec/integration/lib/nulogy_message_bus_producer/subscriptions/risky_subscription_blocker_spec.rb
|
302
|
+
- spec/integration/lib/nulogy_message_bus_producer_spec.rb
|
301
303
|
- spec/integration_spec_helper.rb
|
302
304
|
- spec/nulogy_message_bus_producer/configuration/query_parser_spec.rb
|
303
305
|
- spec/nulogy_message_bus_producer/subscriptions/subscription_spec.rb
|
@@ -312,7 +314,7 @@ files:
|
|
312
314
|
homepage: https://github.com/nulogy/message-bus/tree/master/gems/nulogy_message_bus_producer
|
313
315
|
licenses: []
|
314
316
|
metadata: {}
|
315
|
-
post_install_message:
|
317
|
+
post_install_message:
|
316
318
|
rdoc_options: []
|
317
319
|
require_paths:
|
318
320
|
- lib
|
@@ -323,12 +325,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
323
325
|
version: '2.0'
|
324
326
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
325
327
|
requirements:
|
326
|
-
- - "
|
328
|
+
- - ">"
|
327
329
|
- !ruby/object:Gem::Version
|
328
|
-
version:
|
330
|
+
version: 1.3.1
|
329
331
|
requirements: []
|
330
332
|
rubygems_version: 3.0.3
|
331
|
-
signing_key:
|
333
|
+
signing_key:
|
332
334
|
specification_version: 4
|
333
335
|
summary: Nulogy's code for producing to the Message Bus
|
334
336
|
test_files:
|
@@ -389,6 +391,7 @@ test_files:
|
|
389
391
|
- spec/dummy/log/test.log
|
390
392
|
- spec/dummy/log/development.log
|
391
393
|
- spec/integration_spec_helper.rb
|
394
|
+
- spec/integration/lib/nulogy_message_bus_producer_spec.rb
|
392
395
|
- spec/integration/lib/nulogy_message_bus_producer/repopulate_replication_slots_spec.rb
|
393
396
|
- spec/integration/lib/nulogy_message_bus_producer/config_spec.rb
|
394
397
|
- spec/integration/lib/nulogy_message_bus_producer/subscriptions/risky_subscription_blocker_spec.rb
|