lib/basquiat/adapters/base_message.rb in basquiat-1.2.0 vs lib/basquiat/adapters/base_message.rb in basquiat-1.3.0.pre.1

- old
+ new

@@ -1,29 +1,34 @@ module Basquiat module Adapters + # The simplest Message class. It's encouraged to tailor it to your adapter needs (hence BaseMessage). class BaseMessage < SimpleDelegator attr_reader :action + # @param message [Object] It's assumed that message is some kind of JSON + # @note All unknown messages will be delegated to the resulting Hash def initialize(message) @message = Basquiat::Json.decode(message) super(@message) @action = :ack end - def ack? - fail Basquiat::Errors::SubclassResponsibility + # @!group Action Setters + # Sets the action to be taken after processing to be an ack. + # Here just in case as the default is to acknowledge the message. + def ack + @action = :ack end - def unack - fail Basquiat::Errors::SubclassResponsibility + # Sets the action to be taken after processing to be an nack / reject + def nack + @action = :nack end + # Sets the action to be taken after processing to be a requeue def requeue - fail Basquiat::Errors::SubclassResponsibility + @action = :requeue end - - def delay_redelivery - fail Basquiat::Errors::SubclassResponsibility - end + # @!endgroup end end end