class RailwayIpc::ConsumedMessage
Constants
- STATUS_FAILED_TO_PROCESS
- STATUS_IGNORED
- STATUS_PROCESSING
- STATUS_SUCCESS
- STATUS_UNKNOWN_MESSAGE_TYPE
- VALID_STATUSES
Attributes
decoded_message[R]
Public Class Methods
create_processing(consumer, incoming_message)
click to toggle source
# File lib/railway_ipc/models/consumed_message.rb, line 26 def self.create_processing(consumer, incoming_message) # rubocop:disable Style/RedundantSelf self.create!( uuid: incoming_message.uuid, status: STATUS_PROCESSING, message_type: incoming_message.type, user_uuid: incoming_message.user_uuid, correlation_id: incoming_message.correlation_id, queue: consumer.queue_name, exchange: consumer.exchange_name, encoded_message: incoming_message.payload ) # rubocop:enable Style/RedundantSelf end
Public Instance Methods
processed?()
click to toggle source
# File lib/railway_ipc/models/consumed_message.rb, line 49 def processed? # rubocop:disable Style/RedundantSelf self.status == STATUS_SUCCESS # rubocop:enable Style/RedundantSelf end
update_with_lock(job)
click to toggle source
# File lib/railway_ipc/models/consumed_message.rb, line 41 def update_with_lock(job) with_lock('FOR UPDATE NOWAIT') do job.run self.status = job.status save end end
Private Instance Methods
timestamp_attributes_for_create()
click to toggle source
Calls superclass method
# File lib/railway_ipc/models/consumed_message.rb, line 57 def timestamp_attributes_for_create super << :inserted_at end