lib/postman/message.rb
# Database connection messages indicated temporary issues connecting to the database
# We handle them separately to ensure we can recover from network issues.
Database connection messages indicated temporary issues connecting to the database
We handle them separately to ensure we can recover from network issues.
Database connection messages indicated temporary issues connecting to the database We handle them separately to ensure we can recover from network issues .
def process
      info "Started message process"
      debug payload
      begin
        message.record
        main_exchange.ack(delivery_info.delivery_tag)
      rescue Payload::InvalidMessage => exception
        deadletter(exception)
      rescue ActiveRecord::StatementInvalid => exception
        if database_connection_error?(exception)
          requeue(exception)
          postman.pause!
        else
          delay(exception)
        end
      rescue => exception
        delay(exception)
      end
      info "Finished message process"
    end
def process info "Started message process" debug payload begin message . record main_exchange . ack ( delivery_info . delivery_tag ) rescue Payload :: InvalidMessage => exception deadletter ( exception ) rescue ActiveRecord :: StatementInvalid => exception if database_connection_error? ( exception ) requeue ( exception ) postman . pause! else delay ( exception ) end rescue => exception delay ( exception ) end info "Finished message process" end
Database connection messages indicated temporary issues connecting to the database
We handle them separately to ensure we can recover from network issues.
Database connection messages indicated temporary issues connecting to the database We handle them separately to ensure we can recover from network issues .
# Our message fails to meet our basic requirements, there's little point # sending it to the delayed queue, as it will still be invalid next time. # We have some temporary database issues. Requeue the message and pause # until the issue is resolved.