funktor 0.2.1 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +35 -0
  3. data/.gitignore +2 -2
  4. data/Gemfile.lock +6 -6
  5. data/funktor.gemspec +1 -1
  6. data/lib/funktor.rb +0 -1
  7. data/lib/funktor/cli/bootstrap.rb +7 -7
  8. data/lib/funktor/cli/init.rb +135 -30
  9. data/lib/funktor/cli/templates/Gemfile +1 -3
  10. data/lib/funktor/cli/templates/{workers → app/workers}/hello_worker.rb +0 -0
  11. data/lib/funktor/cli/templates/config/boot.rb +16 -0
  12. data/lib/funktor/cli/templates/config/environment.yml +4 -2
  13. data/lib/funktor/cli/templates/{function_definitions → config/function_definitions}/incoming_job_handler.yml +1 -1
  14. data/lib/funktor/cli/templates/config/function_definitions/work_queue_handler.yml +11 -0
  15. data/lib/funktor/cli/templates/config/funktor.yml +27 -14
  16. data/lib/funktor/cli/templates/{iam_permissions → config/iam_permissions}/incoming_job_queue.yml +0 -0
  17. data/lib/funktor/cli/templates/{iam_permissions → config/iam_permissions}/ssm.yml +0 -0
  18. data/lib/funktor/cli/templates/{iam_permissions/active_job_queue.yml → config/iam_permissions/work_queue.yml} +1 -1
  19. data/lib/funktor/cli/templates/config/package.yml +4 -2
  20. data/lib/funktor/cli/templates/{resources → config/resources}/cloudwatch_dashboard.yml +268 -231
  21. data/lib/funktor/cli/templates/{resources → config/resources}/incoming_job_queue.yml +0 -0
  22. data/lib/funktor/cli/templates/{resources → config/resources}/incoming_job_queue_user.yml +0 -0
  23. data/lib/funktor/cli/templates/config/resources/work_queue.yml +22 -0
  24. data/lib/funktor/cli/templates/funktor_init.yml.tt +69 -0
  25. data/lib/funktor/cli/templates/{handlers → lambda_event_handlers}/incoming_job_handler.rb +1 -1
  26. data/lib/funktor/cli/templates/lambda_event_handlers/work_queue_handler.rb +8 -0
  27. data/lib/funktor/cli/templates/package.json +8 -1
  28. data/lib/funktor/cli/templates/serverless.yml +13 -12
  29. data/lib/funktor/incoming_job_handler.rb +11 -1
  30. data/lib/funktor/job.rb +4 -0
  31. data/lib/funktor/version.rb +1 -1
  32. data/lib/funktor/worker.rb +9 -0
  33. metadata +17 -18
  34. data/lib/funktor/cli/templates/function_definitions/active_job_handler.yml +0 -11
  35. data/lib/funktor/cli/templates/funktor.yml.tt +0 -51
  36. data/lib/funktor/cli/templates/handlers/active_job_handler.rb +0 -17
  37. data/lib/funktor/cli/templates/resources/active_job_queue.yml +0 -22
  38. data/lib/funktor/deploy/cli.rb +0 -42
  39. data/lib/funktor/deploy/serverless.rb +0 -60
  40. data/lib/funktor/deploy/serverless_templates/serverless.yml +0 -156
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 154286564dee4cc895ef3515dcacfa515a91ecde743862e36c833d6db0389447
4
- data.tar.gz: e1786a3bdda966cd7d1fdda07ae3faf12f3ec2ca27b51506257520b3d13b02dd
3
+ metadata.gz: 3a92d7870ba1cde9f91c5d872aab7e5dcc9d7a0d9ee8b4deb75fa1e679ea6ddc
4
+ data.tar.gz: 79d938d9d46f9763ae6bf7001bf54bb1ad48eefee0a0b5dcbb624a934edbba85
5
5
  SHA512:
6
- metadata.gz: c6b7de2400aceac0dcad12d2ad4093a07be595a120f88c58eddf7fa63f3a353e7637c47963cca8e79263b1ec29838ee5c26147a0e924cc7508092ac968e104b2
7
- data.tar.gz: c5cf1bdea5c9ad86415d7da9350b28699900b623a05d4860ecfb11c77daa773fbdd4b1c33a166cfa7c7025a238c268d3748b8a9b9989043e0f29cae6a8446d99
6
+ metadata.gz: b741a360102285bc392c6b846677b1859dbb02652b9e9412773fa989172c4a2368429f7825736f4438a543f4ac058098884fd78ce8a8f89be81b10f6b2e4db94
7
+ data.tar.gz: a450bec63e833671d3eeb7e4e1f00c38eec6c66c59de610ba431f8660a1273dac0ab4db85ff7b41ca2ff9e234c19f771087127d16ab2a21612b731ed61678609
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -10,6 +10,6 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
 
13
- # The funktor dir isn't a real part of the gem, it's where things
13
+ # The funktor app dir isn't a real part of the gem, it's where things
14
14
  # get generated as I'm testing the gem locally. It doesn't need to be in git.
15
- /funktor/
15
+ /myapp-funktor/
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- funktor (0.2.1)
4
+ funktor (0.2.6)
5
5
  activesupport
6
6
  aws-sdk-sqs (~> 1.37)
7
7
  thor
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.1.3.2)
12
+ activesupport (6.1.4)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 1.6, < 2)
15
15
  minitest (>= 5.1)
@@ -18,8 +18,8 @@ GEM
18
18
  addressable (2.7.0)
19
19
  public_suffix (>= 2.0.2, < 5.0)
20
20
  aws-eventstream (1.1.1)
21
- aws-partitions (1.465.0)
22
- aws-sdk-core (3.114.1)
21
+ aws-partitions (1.471.0)
22
+ aws-sdk-core (3.115.0)
23
23
  aws-eventstream (~> 1, >= 1.0.2)
24
24
  aws-partitions (~> 1, >= 1.239.0)
25
25
  aws-sigv4 (~> 1.1)
@@ -29,7 +29,7 @@ GEM
29
29
  aws-sigv4 (~> 1.1)
30
30
  aws-sigv4 (1.2.3)
31
31
  aws-eventstream (~> 1, >= 1.0.2)
32
- concurrent-ruby (1.1.8)
32
+ concurrent-ruby (1.1.9)
33
33
  crack (0.4.5)
34
34
  rexml
35
35
  diff-lcs (1.4.4)
@@ -41,7 +41,7 @@ GEM
41
41
  minitest (5.14.4)
42
42
  public_suffix (4.0.6)
43
43
  rake (12.3.3)
44
- rexml (3.2.4)
44
+ rexml (3.2.5)
45
45
  rspec (3.10.0)
46
46
  rspec-core (~> 3.10.0)
47
47
  rspec-expectations (~> 3.10.0)
data/funktor.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency 'aws-sdk-sqs', '~> 1.37'
33
33
  spec.add_dependency "activesupport" # TODO - Can we build our own verison of cattr_accessor to avoid this?
34
- spec.add_dependency "thor" # TODO - Can we build our own verison of cattr_accessor to avoid this?
34
+ spec.add_dependency "thor" # Thor drives the CLI
35
35
 
36
36
  spec.add_development_dependency 'simplecov'
37
37
  spec.add_development_dependency 'webmock'
data/lib/funktor.rb CHANGED
@@ -11,7 +11,6 @@ require 'json'
11
11
 
12
12
  module Funktor
13
13
  class Error < StandardError; end
14
- # Your code goes here...
15
14
 
16
15
  def self.configure_job_pusher
17
16
  yield self
@@ -3,16 +3,15 @@ module Funktor
3
3
  class Bootstrap < Thor::Group
4
4
  include Thor::Actions
5
5
 
6
+ argument :name, :type => :string, :desc => "The name of the app to initialize"
7
+
6
8
  class_option :file, :aliases => "-f",
7
9
  :type => :string, :desc => "The bootstrap file to generate.",
8
- :default => "funktor.yml"
9
- class_option :directory, :aliases => "-d",
10
- :type => :string, :desc => "The directory to initialize",
11
- :default => "funktor"
10
+ :default => "funktor_init.yml"
12
11
 
13
12
  desc <<~DESC
14
13
  Description:
15
- Bootstrap a new funktor application by generating a funktor.yml file."
14
+ Bootstrap a new funktor application by generating a funktor_init.yml file."
16
15
  DESC
17
16
 
18
17
  def self.source_root
@@ -20,13 +19,14 @@ module Funktor
20
19
  end
21
20
 
22
21
  def funktor_yml
22
+ # TODO - Should we camelize the app name before writing it into the config? (CloudFormation names get weird with underscores and dashes.)
23
23
  puts funktor_file_target
24
- template "templates/funktor.yml", funktor_file_target
24
+ template "templates/funktor_init.yml", funktor_file_target
25
25
  end
26
26
 
27
27
  private
28
28
  def funktor_file_target
29
- File.join options[:directory], options[:file]
29
+ File.join name, options[:file]
30
30
  end
31
31
 
32
32
  end
@@ -1,14 +1,21 @@
1
+ require 'yaml'
2
+ require 'active_support/core_ext/string/inflections'
3
+
1
4
  module Funktor
2
5
  module CLI
3
6
  class Init < Thor::Group
4
7
  include Thor::Actions
5
8
 
6
- class_option :framework, :aliases => "-f",
9
+ attr_accessor :work_queue_name
10
+ attr_accessor :work_queue_config
11
+
12
+ class_option :deployment_framework, :aliases => "-d",
7
13
  :type => :string, :desc => "The deployment/provisioning framework to use.",
8
14
  :default => "serverless"
9
- class_option :directory, :aliases => "-d",
10
- :type => :string, :desc => "The directory to initialize",
11
- :default => "funktor"
15
+
16
+ class_option :file, :aliases => "-f",
17
+ :type => :string, :desc => "The funktor init file.",
18
+ :default => "funktor_init.yml"
12
19
 
13
20
  desc <<~DESC
14
21
  Description:
@@ -20,59 +27,157 @@ module Funktor
20
27
  end
21
28
 
22
29
  def self.destination_root
23
- options[:directory]
24
- end
25
-
26
- def serverless_yml
27
- template "serverless.yml", File.join(options[:directory], "serverless.yml")
30
+ name
28
31
  end
29
32
 
30
33
  def funktor_config_yml
31
- #template "funktor_config.yml", File.join(options[:directory], "funktor_config.yml")
32
- template File.join("config", "funktor.yml"), File.join(options[:directory], "config", "funktor.yml")
33
- template File.join("config", "ruby_layer.yml"), File.join(options[:directory], "config", "ruby_layer.yml")
34
- template File.join("config", "package.yml"), File.join(options[:directory], "config", "package.yml")
35
- template File.join("config", "environment.yml"), File.join(options[:directory], "config", "environment.yml")
34
+ #template "funktor_config.yml", File.join("funktor_config.yml")
35
+ template File.join("config", "funktor.yml"), File.join("config", "funktor.yml")
36
+ template File.join("config", "ruby_layer.yml"), File.join("config", "ruby_layer.yml")
37
+ template File.join("config", "package.yml"), File.join("config", "package.yml")
38
+ template File.join("config", "environment.yml"), File.join("config", "environment.yml")
39
+ template File.join("config", "boot.rb"), File.join("config", "boot.rb")
36
40
  end
37
41
 
38
42
  def package_json
39
- template "package.json", File.join(options[:directory], "package.json")
43
+ template "package.json", File.join("package.json")
40
44
  end
41
45
 
42
46
  def gemfile
43
- template "Gemfile", File.join(options[:directory], "Gemfile")
47
+ template "Gemfile", File.join("Gemfile")
44
48
  end
45
49
 
46
50
  def gitignore
47
- template "gitignore", File.join(options[:directory], ".gitignore")
51
+ template "gitignore", File.join(".gitignore")
52
+ end
53
+
54
+ def workers
55
+ template File.join("app", "workers", "hello_worker.rb"), File.join("app", "workers", "hello_worker.rb")
48
56
  end
49
57
 
50
58
  def resources
51
- template File.join("resources", "incoming_job_queue.yml"), File.join(options[:directory], "resources", "incoming_job_queue.yml")
52
- template File.join("resources", "incoming_job_queue_user.yml"), File.join(options[:directory], "resources", "incoming_job_queue_user.yml")
53
- template File.join("resources", "active_job_queue.yml"), File.join(options[:directory], "resources", "active_job_queue.yml")
54
- template File.join("resources", "cloudwatch_dashboard.yml"), File.join(options[:directory], "resources", "cloudwatch_dashboard.yml")
59
+ template File.join("config", "resources", "incoming_job_queue.yml"), File.join("config", "resources", "incoming_job_queue.yml")
60
+ template File.join("config", "resources", "incoming_job_queue_user.yml"), File.join("config", "resources", "incoming_job_queue_user.yml")
61
+ # TODO - Figure out how to make the dashboard aware of various queues...
62
+ template File.join("config", "resources", "cloudwatch_dashboard.yml"), File.join("config", "resources", "cloudwatch_dashboard.yml")
63
+ queues.each do |queue_details|
64
+ @work_queue_name = queue_details.keys.first
65
+ @work_queue_config = queue_details.values.first
66
+ template File.join("config", "resources", "work_queue.yml"), File.join("config", "resources", "#{work_queue_name.underscore}_queue.yml")
67
+ end
55
68
  end
56
69
 
57
70
  def iam_permissions
58
- template File.join("iam_permissions", "ssm.yml"), File.join(options[:directory], "iam_permissions", "ssm.yml")
59
- template File.join("iam_permissions", "incoming_job_queue.yml"), File.join(options[:directory], "iam_permissions", "incoming_job_queue.yml")
60
- template File.join("iam_permissions", "active_job_queue.yml"), File.join(options[:directory], "iam_permissions", "active_job_queue.yml")
71
+ template File.join("config", "iam_permissions", "ssm.yml"), File.join("config", "iam_permissions", "ssm.yml")
72
+ template File.join("config", "iam_permissions", "incoming_job_queue.yml"), File.join("config", "iam_permissions", "incoming_job_queue.yml")
73
+ queues.each do |queue_details|
74
+ @work_queue_name = queue_details.keys.first
75
+ @work_queue_config = queue_details.values.first
76
+ template File.join("config", "iam_permissions", "work_queue.yml"), File.join("config", "iam_permissions", "#{work_queue_name.underscore}_queue.yml")
77
+ end
61
78
  end
62
79
 
63
80
  def function_definitions
64
- template File.join("function_definitions", "active_job_handler.yml"), File.join(options[:directory], "function_definitions", "active_job_handler.yml")
65
- template File.join("function_definitions", "incoming_job_handler.yml"), File.join(options[:directory], "function_definitions", "incoming_job_handler.yml")
81
+ template File.join("config", "function_definitions", "incoming_job_handler.yml"), File.join("config", "function_definitions", "incoming_job_handler.yml")
82
+ queues.each do |queue_details|
83
+ @work_queue_name = queue_details.keys.first
84
+ @work_queue_config = queue_details.values.first
85
+ template File.join("config", "function_definitions", "work_queue_handler.yml"), File.join("config", "function_definitions", "#{work_queue_name.underscore}_queue_handler.yml")
86
+ end
66
87
  end
67
88
 
68
89
  def lambda_handlers
69
- template File.join("handlers", "active_job_handler.rb"), File.join(options[:directory], "handlers", "active_job_handler.rb")
70
- template File.join("handlers", "incoming_job_handler.rb"), File.join(options[:directory], "handlers", "incoming_job_handler.rb")
90
+ template File.join("lambda_event_handlers", "incoming_job_handler.rb"), File.join("lambda_event_handlers", "incoming_job_handler.rb")
91
+ queues.each do |queue_details|
92
+ @work_queue_name = queue_details.keys.first
93
+ @work_queue_config = queue_details.values.first
94
+ template File.join("lambda_event_handlers", "work_queue_handler.rb"), File.join("lambda_event_handlers", "#{work_queue_name.underscore}_queue_handler.rb")
95
+ end
71
96
  end
72
97
 
73
- def workers
74
- template File.join("workers", "hello_worker.rb"), File.join(options[:directory], "workers", "hello_worker.rb")
98
+ def serverless_yml
99
+ template "serverless.yml", File.join("serverless.yml")
100
+ end
101
+
102
+ private
103
+
104
+ def app_worker_names
105
+ app_worker_files.map do |file|
106
+ File.basename(file, ".rb").camelize
107
+ end
108
+ end
109
+
110
+ def app_worker_files
111
+ Dir.glob(File.join('app', 'workers', '**.rb'))
112
+ end
113
+
114
+ def all_iam_permissions
115
+ Dir.glob(File.join('config', 'iam_permissions', '**.yml'))
116
+ end
117
+
118
+ def all_function_definitions
119
+ Dir.glob(File.join('config', 'function_definitions', '**.yml'))
120
+ end
121
+
122
+ def all_resources
123
+ Dir.glob(File.join('config', 'resources', '**.yml'))
124
+ end
125
+
126
+ def funktor_config
127
+ @funktor_config ||= YAML.load_file options[:file]
128
+ end
129
+
130
+ def name
131
+ funktor_config["appName"]
132
+ end
133
+
134
+ def app_name
135
+ funktor_config["appName"]
136
+ end
137
+
138
+ def runtime
139
+ funktor_config["runtime"]
140
+ end
141
+
142
+ def queues
143
+ funktor_config["queues"]
75
144
  end
145
+
146
+ def queue_names
147
+ funktor_config["queues"].map{|queue_details| queue_details.keys.first }
148
+ end
149
+
150
+ def work_queue_name
151
+ @work_queue_name
152
+ end
153
+
154
+ def work_queue_config
155
+ @work_queue_config
156
+ end
157
+
158
+ def queue_config(queue_name)
159
+ funktor_config["queues"].each do |queue_details|
160
+ if queue_details.keys.first == queue_name
161
+ return queue_details.values.first
162
+ end
163
+ end
164
+ return nil
165
+ end
166
+
167
+ def incoming_config_value(config_name)
168
+ funktor_config.dig("incomingJobHandler", config_name) ||
169
+ funktor_config.dig("handlerDefaults", config_name) ||
170
+ "null" # When we parse yaml 'null' gets turned to nil, which comes out as an empty string in the template
171
+ end
172
+
173
+ def queue_config_value(queue_name, config_name)
174
+ puts funktor_config
175
+ queue_config(queue_name)&.dig(config_name) ||
176
+ funktor_config.dig("handlerDefaults", config_name) ||
177
+ "null" # When we parse yaml 'null' gets turned to nil, which comes out as an empty string in the template
178
+
179
+ end
180
+
76
181
  end
77
182
  end
78
183
  end
@@ -3,7 +3,5 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  ruby '~> 2.7'
5
5
 
6
- source "https://gem.fury.io/jagthedrummer/" do
7
- gem 'funktor'
8
- end
6
+ gem 'funktor'
9
7
 
@@ -0,0 +1,16 @@
1
+ # Point at our Gemfile
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+
4
+ # load rubygems & bundler
5
+ require "rubygems"
6
+ require 'bundler/setup'
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ Bundler.require(:default, :production)
10
+
11
+ # Load all ruby files in the app directory
12
+ Dir.glob( File.join('..', 'app', '**', '*.rb'), base: File.dirname(__FILE__) ).each do |ruby_file|
13
+ puts "require_relative #{ruby_file}"
14
+ require_relative ruby_file
15
+ end
16
+
@@ -1,4 +1,6 @@
1
1
  FUNKTOR_INCOMING_JOB_QUEUE:
2
2
  Ref: IncomingJobQueue
3
- FUNKTOR_ACTIVE_JOB_QUEUE:
4
- Ref: ActiveJobQueue
3
+ <%- queue_names.each do |queue_name| -%>
4
+ FUNKTOR_<%= queue_name.underscore.upcase %>_QUEUE:
5
+ Ref: <%= queue_name.camelize %>Queue
6
+ <%- end -%>
@@ -1,4 +1,4 @@
1
- handler: handlers/incoming_job_handler.call
1
+ handler: lambda_event_handlers/incoming_job_handler.call
2
2
  timeout: ${self:custom.funktor.incomingJobHandler.timeout, 30}
3
3
  reservedConcurrency: ${self:custom.funktor.incomingJobHandler.reservedConcurrency, null}
4
4
  provisionedConcurrency: ${self:custom.funktor.incomingJobHandler.provisionedConcurrency, null}
@@ -0,0 +1,11 @@
1
+ handler: lambda_event_handlers/<%= work_queue_name.underscore %>_queue_handler.call
2
+ timeout: ${self:custom.funktor.<%= work_queue_name.camelize %>QueueHandler.timeout, 900}
3
+ reservedConcurrency: ${self:custom.funktor.<%= work_queue_name.camelize %>QueueHandler.reservedConcurrency, null}
4
+ provisionedConcurrency: ${self:custom.funktor.<%= work_queue_name.camelize %>QueueHandler.provisionedConcurrency, null}
5
+ memorySize: ${self:custom.funktor.<%= work_queue_name.camelize %>QueueHandler.memorySize, 256}
6
+ events:
7
+ - sqs:
8
+ arn:
9
+ Fn::GetAtt:
10
+ - <%= work_queue_name.camelize %>Queue
11
+ - Arn
@@ -3,49 +3,62 @@ incomingJobHandler:
3
3
  # to a handler at one time, so you'll want this to be at least 10x the maximum time you
4
4
  # expect to spend for one message. The incoming job handler usually will be pretty fast,
5
5
  # but we default to a high number here to allow for the times when things go weird.
6
- timeout: 900
6
+ timeout: <%= incoming_config_value 'timeout' %>
7
7
  # reservedConcurrency represents the maximum number of concurrent executions.
8
8
  # For the incoming job handler you probably don't want to limit it because you
9
9
  # want to get things onto work queues as quickly as possible.
10
- reservedConcurrency: null
10
+ reservedConcurrency: <%= incoming_config_value 'reservedConcurrency' %>
11
11
  # provisionedConcurrency represents the number of lambda functions that will always
12
12
  # be available. For the incoming jobs handler you probably don't need to set this
13
13
  # unless your jobs are very bursty AND very time sensitive.
14
- provisionedConcurrency: null
14
+ provisionedConcurrency: <%= incoming_config_value 'provisionedConcurrency' %>
15
15
  # Use memory_size to adjust the reousrces (both memory and CPU) available.
16
16
  # For the incoming jobs handler you probably don't need this to be too large,
17
17
  # but if you're seeing large delays at this stage it might help to bump it up.
18
- memorySize: 256
18
+ memorySize: <%= incoming_config_value 'memorySize' %>
19
+ batchSize: <%= incoming_config_value 'batchSize' %>
20
+ maximumBatchingWindow: <%= incoming_config_value 'maximumBatchingWindow' %>
21
+ visibilityTimeout: <%= incoming_config_value 'visibilityTimeout' %>
22
+ logRetentionInDays: <%= incoming_config_value 'logRetentionInDays' %>
19
23
 
20
- activeJobHandler:
24
+ <%- queue_names.each do |queue_name| -%>
25
+ <%= queue_name.camelize %>QueueHandler:
21
26
  # timeout is how long the handler can possibly run. Up to 10 messages may be delivered
22
27
  # to a handler at one time, so you'll want this to be at least 10x the maximum time you
23
28
  # expect to spend for one message. The active job handler may be slow if your jobs are
24
29
  # doing a lot of work, so we default to the maximum here.
25
- timeout: 900
30
+ timeout: <%= queue_config_value queue_name, 'timeout' %>
26
31
  # reservedConcurrency represents the maximum number of concurrent executions.
27
32
  # For the active job handler you may want to limit it if you have resource limitations
28
33
  # like database connections that you need to avoid exhausting.
29
- reservedConcurrency: null
34
+ reservedConcurrency: <%= queue_config_value queue_name, 'reservedConcurrency' %>
30
35
  # provisionedConcurrency represents the number of lambda functions that will always
31
36
  # be available. For the active job handler you probably don't need to set this
32
37
  # unless your jobs are very bursty AND very time sensitive.
33
- provisionedConcurrency: null
38
+ provisionedConcurrency: <%= queue_config_value queue_name, 'provisionedConcurrency' %>
34
39
  # Use memory_size to adjust the reousrces (both memory and CPU) available.
35
40
  # For the active jobs handler you'll want this to be at least as large as the memory
36
41
  # required to actually do your jobs. You can choose an even higher number to increase
37
42
  # the available CPU to make the jobs run faster.
38
- memorySize: 256
43
+ memorySize: <%= queue_config_value queue_name, 'memorySize' %>
44
+ batchSize: <%= queue_config_value queue_name, 'batchSize' %>
45
+ maximumBatchingWindow: <%= queue_config_value queue_name, 'maximumBatchingWindow' %>
46
+ visibilityTimeout: <%= queue_config_value queue_name, 'visibilityTimeout' %>
47
+ logRetentionInDays: <%= queue_config_value queue_name, 'logRetentionInDays' %>
39
48
 
49
+ <%- end -%>
40
50
 
41
51
 
42
52
  # You shouldn't need to mess with these under most circumstances. But you could if you want to change
43
53
  # the name of some of your resources in AWS.
44
54
  incomingJobQueueName: ${self:service}-${self:custom.stage}-incoming-jobs
55
+ incomingDeadJobQueueName: ${self:service}-${self:custom.stage}-incoming-dead
45
56
  incomingJobQueueAccessPolicyName: ${self:service}-${self:custom.stage}-incoming-job-queue-access
46
- incomingDeadJobQueueName: ${self:service}-${self:custom.stage}-incoming-dead-jobs
47
- activeJobQueueName: ${self:service}-${self:custom.stage}-active-jobs
48
- activityQueueName: ${self:service}-${self:custom.stage}-activity
49
- activityDeadQueueName: ${self:service}-${self:custom.stage}-activity-dead
50
- deadJobQueueName: ${self:service}-${self:custom.stage}-dead-jobs
51
57
  dashboardName: ${self:service}-${self:custom.stage}-dashboard
58
+ <%- queue_names.each do |queue_name| -%>
59
+ <%= queue_name.camelize %>QueueName: ${self:service}-${self:custom.stage}-<%= queue_name.underscore.dasherize %>
60
+ <%= queue_name.camelize %>DeadJobQueueName: ${self:service}-${self:custom.stage}-<%= queue_name.underscore.dasherize %>-dead
61
+ <%= queue_name.camelize %>QueueHandlerName: ${self:service}-${self:custom.stage}-<%= queue_name.camelize %>QueueHandler
62
+ <%- end -%>
63
+
64
+