mirror of
https://github.com/ditkrg/outboxable.git
synced 2026-01-22 22:06:47 +00:00
Adds metadata to outboxes
This commit is contained in:
parent
08ef9242e5
commit
61767b40c2
@ -27,7 +27,12 @@ module Outboxable
|
|||||||
outboxes.new(
|
outboxes.new(
|
||||||
routing_key:,
|
routing_key:,
|
||||||
exchange: Outboxable.configuration.rabbitmq_exchange_name,
|
exchange: Outboxable.configuration.rabbitmq_exchange_name,
|
||||||
payload: as_json
|
payload: as_json,
|
||||||
|
metadata: if respond_to?(:metadata_for_outbox)
|
||||||
|
metadata_for_outbox
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ class CreateOutboxableOutboxes < ActiveRecord::Migration[7.0]
|
|||||||
|
|
||||||
t.jsonb :payload, default: {}
|
t.jsonb :payload, default: {}
|
||||||
t.jsonb :headers, default: {}
|
t.jsonb :headers, default: {}
|
||||||
|
t.jsonb :metadata, default: {}, null: true
|
||||||
|
|
||||||
t.integer :size, null: false, default: 0
|
t.integer :size, null: false, default: 0
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class Outbox
|
|||||||
|
|
||||||
field :payload, type: Hash, default: {}
|
field :payload, type: Hash, default: {}
|
||||||
field :headers, type: Hash, default: {}
|
field :headers, type: Hash, default: {}
|
||||||
|
field :metadata, type: Hash, default: {}
|
||||||
|
|
||||||
index({ idempotency_key: 1 }, { unique: true, name: 'idempotency_key_unique_index' })
|
index({ idempotency_key: 1 }, { unique: true, name: 'idempotency_key_unique_index' })
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user