Class: Fractor::Workflow::DeadLetterQueue::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/fractor/workflow/dead_letter_queue.rb

Overview

Entry in the dead letter queue

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject (readonly)

Returns the value of attribute context.



29
30
31
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29

def context
  @context
end

#errorObject (readonly)

Returns the value of attribute error.



29
30
31
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29

def error
  @error
end

#metadataObject (readonly)

Returns the value of attribute metadata.



29
30
31
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29

def 
  @metadata
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



29
30
31
# File 'lib/fractor/workflow/dead_letter_queue.rb', line 29

def timestamp
  @timestamp
end

#workObject (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_hHash

Convert entry to hash for serialization

Returns:

  • (Hash)

    Entry data as hash



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: timestamp.iso8601,
    metadata: ,
  }
end