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
17
# File 'lib/workling/clients/rude_q_client.rb', line 9

def self.installed?
  begin
    gem 'rudeq'
    require 'rudeq' 
  rescue LoadError
  end

  Object.const_defined? "RudeQueue"
end

.loadObject



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

def self.load
  begin
    gem 'rudeq'
    require 'rudeq'
  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



33
34
# File 'lib/workling/clients/rude_q_client.rb', line 33

def close
end

#connectObject

no-op as the db connection should exists always



29
30
# File 'lib/workling/clients/rude_q_client.rb', line 29

def connect
end

#request(key, value) ⇒ Object

implements the client job request and retrieval



37
38
39
# File 'lib/workling/clients/rude_q_client.rb', line 37

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

#retrieve(key) ⇒ Object



41
42
43
# File 'lib/workling/clients/rude_q_client.rb', line 41

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