Class: Workling::Clients::RudeQClient

Inherits:
BrokerBase show all
Defined in:
lib/workling/clients/rude_q_client.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BrokerBase

#dispatch, #subscribe

Methods inherited from Base

#dispatch, #logger, #subscribe

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
# File 'lib/workling/clients/rude_q_client.rb', line 9

def self.installed?
  begin
    gem 'matthewrudy-rudeq', :lib => 'rude_q'
  rescue LoadError
  end

  Object.const_defined? "RudeQueue"
end

.loadObject



18
19
20
21
22
23
24
# File 'lib/workling/clients/rude_q_client.rb', line 18

def self.load
  begin
    gem 'matthewrudy-rudeq', :lib => 'rude_q'
  rescue Gem::LoadError
    Workling::Base.logger.info "WORKLING: couldn't find rudeq library. Install: \"gem install matthewrudy-rudeq\". "
  end
end

Instance Method Details

#closeObject

again a no-op as we would want to yank out the db connection behind the apps back



31
32
# File 'lib/workling/clients/rude_q_client.rb', line 31

def close
end

#connectObject

no-op as the db connection should exists always



27
28
# File 'lib/workling/clients/rude_q_client.rb', line 27

def connect
end

#request(key, value) ⇒ Object

implements the client job request and retrieval



35
36
37
# File 'lib/workling/clients/rude_q_client.rb', line 35

def request(key, value)
  RudeQueue.set(key, value)
end

#retrieve(key) ⇒ Object



39
40
41
# File 'lib/workling/clients/rude_q_client.rb', line 39

def retrieve(key)
  RudeQueue.get(key)
end