Class: Camunda::Poller

Inherits:
Object
  • Object
show all
Defined in:
lib/camunda/poller.rb

Overview

The poller will run as an infinite loop with long polling to fetch tasks, queue, and run them. Topic is the process definition key. Below will run the poller to fetch, lock, and queue a task for the example process definition with an id of CamundaWorkflow.

Examples:

Camunda::Poller.fetch_and_queue %w[CamundaWorkflow]

Class Method Summary collapse

Class Method Details

.fetch_and_execute(topics, lock_duration: nil, long_polling_duration: nil) ⇒ Object

Deprecated.

Please use #fetch_and_queue instead



8
9
10
11
# File 'lib/camunda/poller.rb', line 8

def self.fetch_and_execute(topics, lock_duration: nil, long_polling_duration: nil)
  warn "[DEPRECATION] `fetch_and_execute` is deprecated.  Please use `fetch_and_queue` instead."
  fetch_and_queue(topics, lock_duration: lock_duration, long_polling_duration: long_polling_duration)
end

.fetch_and_queue(topics, lock_duration: nil, long_polling_duration: nil) ⇒ Object

Parameters:

  • topics (Array)

    process definition keys

  • lock_duration (Integer) (defaults to: nil)

    lock duration time, default time is set in Camunda::Workflow.configuration

  • long_polling_duration (Integer) (defaults to: nil)

    long polling time, default is set to Camunda::Workflow.configuration



16
17
18
19
20
# File 'lib/camunda/poller.rb', line 16

def self.fetch_and_queue(topics, lock_duration: nil, long_polling_duration: nil)
  loop do
    Camunda::ExternalTask.fetch_and_queue(topics, lock_duration: lock_duration, long_polling_duration: long_polling_duration)
  end
end