Class: Fractor::Workflow::DeadLetterQueue::Entry
- Inherits:
-
Object
- Object
- Fractor::Workflow::DeadLetterQueue::Entry
- Defined in:
- lib/fractor/workflow/dead_letter_queue.rb
Overview
Entry in the dead letter queue
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#work ⇒ Object
readonly
Returns the value of attribute work.
Instance Method Summary collapse
-
#initialize(work:, error:, context: nil, metadata: {}) ⇒ Entry
constructor
A new instance of Entry.
-
#to_h ⇒ Hash
Convert entry to hash for serialization.
Constructor Details
#initialize(work:, error:, context: nil, metadata: {}) ⇒ Entry
Returns a new instance of Entry.
31 32 33 34 35 36 37 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 31 def initialize(work:, error:, context: nil, metadata: {}) @work = work @error = error @context = context @timestamp = Time.now @metadata = end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
29 30 31 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29 def context @context end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
29 30 31 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29 def error @error end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
29 30 31 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29 def @metadata end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
29 30 31 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29 def @timestamp end |
#work ⇒ Object (readonly)
Returns the value of attribute work.
29 30 31 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29 def work @work end |
Instance Method Details
#to_h ⇒ Hash
Convert entry to hash for serialization
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 42 def to_h { work: work, error: error.to_s, error_class: error.class.name, context: context&.to_h, timestamp: .iso8601, metadata: , } end |