Class: RubyEventStore::Outbox::Repository::Record

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/ruby_event_store/outbox/repository.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for_fetch_specification(fetch_specification) ⇒ Object



19
20
21
# File 'lib/ruby_event_store/outbox/repository.rb', line 19

def self.for_fetch_specification(fetch_specification)
  where(format: fetch_specification.message_format, split_key: fetch_specification.split_key)
end

.remaining_for(fetch_specification) ⇒ Object



15
16
17
# File 'lib/ruby_event_store/outbox/repository.rb', line 15

def self.remaining_for(fetch_specification)
  where(format: fetch_specification.message_format, split_key: fetch_specification.split_key, enqueued_at: nil)
end

Instance Method Details

#enqueued?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ruby_event_store/outbox/repository.rb', line 27

def enqueued?
  !enqueued_at.nil?
end

#hash_payloadObject



23
24
25
# File 'lib/ruby_event_store/outbox/repository.rb', line 23

def hash_payload
  JSON.parse(payload).deep_symbolize_keys
end