Class: WorkflowRb::SingleNodeQueueProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/workflow_rb/services/single_node_queue_provider.rb

Instance Method Summary collapse

Constructor Details

#initializeSingleNodeQueueProvider

Returns a new instance of SingleNodeQueueProvider.



6
7
8
9
# File 'lib/workflow_rb/services/single_node_queue_provider.rb', line 6

def initialize
  @process_queue = Queue.new
  @publish_queue = Queue.new
end

Instance Method Details

#dequeue_for_processingObject



15
16
17
18
19
20
21
# File 'lib/workflow_rb/services/single_node_queue_provider.rb', line 15

def dequeue_for_processing
  begin
    return @process_queue.pop(true)
  rescue
    return nil
  end
end

#dequeue_for_publishObject



27
28
29
30
31
32
33
# File 'lib/workflow_rb/services/single_node_queue_provider.rb', line 27

def dequeue_for_publish
  begin
    return @publish_queue.pop(true)
  rescue
    return nil
  end
end

#queue_for_processing(id) ⇒ Object



11
12
13
# File 'lib/workflow_rb/services/single_node_queue_provider.rb', line 11

def queue_for_processing(id)
  @process_queue << id
end

#queue_for_publish(pub) ⇒ Object



23
24
25
# File 'lib/workflow_rb/services/single_node_queue_provider.rb', line 23

def queue_for_publish(pub)
  @publish_queue << pub
end