ntswf 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,9 +39,9 @@ module Ntswf
39
39
 
40
40
  def process_activity_task
41
41
  announce("polling for activity task #{activity_task_list}")
42
- domain.activity_tasks.poll_for_single_task(activity_task_list) do |activity_task|
43
- announce("got activity task #{activity_task.activity_type.inspect} #{activity_task.input}")
44
- process_single_task activity_task
42
+ domain.activity_tasks.poll_for_single_task(activity_task_list, poll_options) do |task|
43
+ announce("got activity task #{task.activity_type.inspect} #{task.input}")
44
+ process_single_task(task)
45
45
  end
46
46
  end
47
47
 
data/lib/ntswf/base.rb CHANGED
@@ -16,6 +16,10 @@ module Ntswf
16
16
  # (see {Client#start_execution}'s *:execution_id* for allowed values)
17
17
  # @option config [Numeric] :execution_version
18
18
  # Value allowing clients to reject future execution versions
19
+ # @option config [String] :identity_suffix
20
+ # When polling for a task, the suffix will be appended to the (default) identity
21
+ # (<hostname>:<pid>), delimited by a ":".
22
+ # Allows to distinguish worker activity on different hosts with identical hostnames.
19
23
  # @option config [String] :isolation_file
20
24
  # Development/test option.
21
25
  # A random ID is stored at the given path, and prepended to task list names and execution IDs.
@@ -19,7 +19,7 @@ module Ntswf
19
19
  # :seconds_until_retry:: See {ActivityWorker#on_activity}
20
20
  def process_decision_task
21
21
  announce("polling for decision task #{decision_task_list}")
22
- domain.decision_tasks.poll_for_single_task(decision_task_list) do |task|
22
+ domain.decision_tasks.poll_for_single_task(decision_task_list, poll_options) do |task|
23
23
  announce("got decision task #{task.workflow_execution.inspect}")
24
24
  begin
25
25
  task.new_events.each { |event| process_decision_event(task, event) }
data/lib/ntswf/worker.rb CHANGED
@@ -54,5 +54,16 @@ module Ntswf
54
54
  def create_pidfile
55
55
  IO.write(@config.pidfile, Process.pid)
56
56
  end
57
+
58
+ private
59
+
60
+ def poll_options
61
+ options = {}
62
+ if @config.identity_suffix
63
+ options[:identity] = "#{Socket.gethostname}:#{Process.pid}:#{@config.identity_suffix}"
64
+ end
65
+ options
66
+ end
67
+
57
68
  end
58
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ntswf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-14 00:00:00.000000000 Z
12
+ date: 2014-08-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk