Class: RbEAI::RouterTask

Inherits:
Task
  • Object
show all
Defined in:
lib/rbeai/TasksLogic.rb

Overview

<task name=“router” type=“Router” pool=“2”>

  <next>
    <goto task="sendfile">
      <when filter="xpath:/test/status">91,92</when>
      <!--<when filter="name:test.txt"/>-->
    </goto>
    <goto task="sendftp">              
      <when filter="sax:status">91,92</when>
      <!--<when filter="name:test_2.txt"/>-->
    </goto>            
    <goto task="final"/>
  </next>
</task>

Instance Attribute Summary collapse

Attributes inherited from Task

#name, #size, #status, #wflow

Instance Method Summary collapse

Methods inherited from Task

#getItemsNext, #persist, #persistFtp, #persistStr

Constructor Details

#initialize(wflow, xmlFull, xmlDoc) ⇒ RouterTask

Returns a new instance of RouterTask.



92
93
94
95
# File 'lib/rbeai/TasksLogic.rb', line 92

def initialize(wflow, xmlFull, xmlDoc)
  @logic = RouterLogic.new(xmlDoc)
  super(wflow, xmlFull, xmlDoc)
end

Instance Attribute Details

#nextTaskObject

Returns the value of attribute nextTask.



88
89
90
# File 'lib/rbeai/TasksLogic.rb', line 88

def nextTask
  @nextTask
end

Instance Method Details

#doJob(resultQueueList, obj) ⇒ Object



97
98
99
100
101
# File 'lib/rbeai/TasksLogic.rb', line 97

def doJob(resultQueueList, obj)
  task = @logic.enroute(obj)
  print task, "=> ", obj , "\n"
  resultQueueList[task].enq(obj) if task != nil
end

#initQueuesObject



103
104
105
106
107
108
109
# File 'lib/rbeai/TasksLogic.rb', line 103

def initQueues()
  resultQueueList = Hash.new(0)
  @logic.destinations.each do | task, logic|
    resultQueueList[task] = Queue.new
  end
  return resultQueueList
end