class ActiveCrew::Base

Sidekiq Command class. Implements command pattern for Sidekiq. Helps to deconstruct application into micro services with command interface.

Command class file structure with two micro services (mailer and users):

app
  commands
    mailer
      deliver_command.rb
    users
      create_command.rb

Command queues will be the following:

mailer
users

Attributes

context[R]
invoker[R]
options[R]

Public Class Methods

new(invoker, context = {}) click to toggle source
# File lib/active_crew/base.rb, line 32
def initialize(invoker, context = {})
  @invoker = invoker
  # Should only symbolize key for
  @context = ActiveSupport::HashWithIndifferentAccess.new context
  @options = @context[:options] || {}
end

Public Instance Methods

execute() click to toggle source
# File lib/active_crew/base.rb, line 43
def execute
  perform
end
name() click to toggle source
# File lib/active_crew/base.rb, line 39
def name
  @name ||= self.class.name.underscore.gsub(/_command/, '')
end
perform() click to toggle source
# File lib/active_crew/base.rb, line 47
def perform
end