Exception: Postburner::Job::MalformedResponse

Inherits:
StandardError
  • Object
show all
Defined in:
app/models/postburner/job.rb

Overview

Exception raised when a queue strategy returns an invalid response format.

Queue strategies must return a Hash with an ‘:id` key when inserting jobs. The `:id` value represents the Beanstalkd job ID (can be nil for test strategies). This exception is raised in Insertion#insert! when a strategy returns a malformed response.

Examples:

Valid response formats

{ id: 12345, status: "INSERTED" }  # Production with Beanstalkd ID
{ id: nil, status: "INLINE" }      # Test strategy without Beanstalkd

Invalid response (raises MalformedResponse)

"success"                          # Not a Hash
{ status: "INSERTED" }             # Missing :id key
{ "id" => 12345 }                  # String key instead of symbol

Handling in custom strategy

class MyStrategy
  def self.insert(job, options = {})
    # Must return Hash with :id key (symbol)
    { id: nil, status: "QUEUED" }
  end
end

See Also: