forked from active-elastic-job/active-elastic-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Elastic Beanstalk's Periodic Tasks
Intercept messages which have been enqueued by the EB worker environment itself due to a present cron.yaml file. Further information on Elastic Beanstalk's Periodic task feature is available in Amazon's official documentation: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html#worker-periodictasks Close active-elastic-job#40
- Loading branch information
Showing
6 changed files
with
98 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
spec/integration/rails-app-4.2/app/jobs/periodic_task_job.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'net/http' | ||
|
||
class PeriodicTaskJob < ActiveJob::Base | ||
WEB_ENV_HOST = ENV['WEB_ENV_HOST'] | ||
WEB_ENV_PORT = ENV['WEB_ENV_PORT'] | ||
|
||
def perform | ||
Net::HTTP.start(WEB_ENV_HOST, WEB_ENV_PORT, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |https| | ||
request = Net::HTTP::Delete.new "/random_strings/from_periodic_task" | ||
https.request request | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: 1 | ||
cron: | ||
- name: "PeriodicTaskJob" | ||
url: "/periodic_tasks" | ||
schedule: "* * * * *" |
13 changes: 13 additions & 0 deletions
13
spec/integration/rails-app-5.0/app/jobs/periodic_task_job.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'net/http' | ||
|
||
class PeriodicTaskJob < ActiveJob::Base | ||
WEB_ENV_HOST = ENV['WEB_ENV_HOST'] | ||
WEB_ENV_PORT = ENV['WEB_ENV_PORT'] | ||
|
||
def perform | ||
Net::HTTP.start(WEB_ENV_HOST, WEB_ENV_PORT, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |https| | ||
request = Net::HTTP::Delete.new "/random_strings/from_periodic_task" | ||
https.request request | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: 1 | ||
cron: | ||
- name: "PeriodicTaskJob" | ||
url: "/periodic_tasks" | ||
schedule: "* * * * *" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters