Class: Railbox::Models::TransactionalOutbox
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Railbox::Models::TransactionalOutbox
- Defined in:
- lib/railbox/models/transactional_outbox.rb
Overview
Schema Information
Table name: transactional_outboxes
id :bigint not null, primary key
action_type :string not null # Type of action/event (class_method/http)
action_data :jsonb not null # Action data or payload ({process_class: "MyService", process_method: "create"}/{method: "POST", url: "https://..."}) (default: {})
status :string not null # Processing status (e.g. in_progress, failed, completed)
entity_type :string # Polymorphic type for associated entity
entity_id :integer # Polymorphic ID for associated entity
query :jsonb # Url query (JSON)
body :jsonb # Main body/payload (default: {})
headers :jsonb # Headers (default: {})
meta :jsonb # Metadata or extra info (JSON)
attempts :integer default(0) # Number of processing attempts
retry_at :datetime # Next retry timestamp
failure_reasons :jsonb, array # Array of failure reason objects
created_at :datetime not null # Record creation timestamp
updated_at :datetime not null # Last update timestamp
Indexes
index_transactional_outboxes_on_entity_type_and_entity_id (entity_type,entity_id)
Purpose:
- Queues reliable actions/events for external systems.
- Tracks delivery status and retry logic.
- Stores metadata and failure reasons for auditing/debugging.
Instance Method Summary collapse
Instance Method Details
#entity_group ⇒ Object
43 44 45 |
# File 'lib/railbox/models/transactional_outbox.rb', line 43 def entity_group "#{entity_type}.#{entity_id}" end |
#group ⇒ Object
39 40 41 |
# File 'lib/railbox/models/transactional_outbox.rb', line 39 def group action_data[:group] end |
#in_group? ⇒ Boolean
35 36 37 |
# File 'lib/railbox/models/transactional_outbox.rb', line 35 def in_group? group.present? || entity_group.present? end |