{"id":29059114,"url":"https://github.com/esminc/activejob-google_cloud_tasks-http","last_synced_at":"2025-06-27T07:04:37.851Z","repository":{"id":35145728,"uuid":"212707156","full_name":"esminc/activejob-google_cloud_tasks-http","owner":"esminc","description":"Active Job adapter for Google Cloud Tasks HTTP targets","archived":false,"fork":false,"pushed_at":"2025-05-24T09:45:15.000Z","size":33,"stargazers_count":32,"open_issues_count":3,"forks_count":5,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-06-25T20:49:17.612Z","etag":null,"topics":["activejob","google-cloud-run","google-cloud-tasks","rails","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esminc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-04T00:27:49.000Z","updated_at":"2025-06-23T00:52:22.000Z","dependencies_parsed_at":"2023-01-15T14:45:06.324Z","dependency_job_id":null,"html_url":"https://github.com/esminc/activejob-google_cloud_tasks-http","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/esminc/activejob-google_cloud_tasks-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Factivejob-google_cloud_tasks-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Factivejob-google_cloud_tasks-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Factivejob-google_cloud_tasks-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Factivejob-google_cloud_tasks-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esminc","download_url":"https://codeload.github.com/esminc/activejob-google_cloud_tasks-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esminc%2Factivejob-google_cloud_tasks-http/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261966752,"owners_count":23237639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activejob","google-cloud-run","google-cloud-tasks","rails","ruby"],"created_at":"2025-06-27T07:02:03.775Z","updated_at":"2025-06-27T07:04:37.844Z","avatar_url":"https://github.com/esminc.png","language":"Ruby","readme":"# ActiveJob::GoogleCloudTasks::HTTP\n\nActiveJob::GoogleCloudTasks::HTTP is an ActiveJob adapter for running jobs via Google Cloud Tasks. As the name suggests it only supports HTTP targets.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activejob-google_cloud_tasks-http'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install activejob-google_cloud_tasks-http\n\n## Usage\n\n### Setup\n\nConfigure an adapter instance and pass it to Active Job:\n\n```ruby\nRails.application.config.active_job.queue_adapter = ActiveJob::GoogleCloudTasks::HTTP::Adapter.new(\n  project: 'a-gcp-project-name',\n  location: 'asia-northeast1',\n  url: 'https://hibariya.org/',\n  client: Google::Cloud::Tasks.cloud_tasks, # optional\n  task_options: { # optional\n    oidc_token: {\n      service_account_email: 'cloudrun-invoker@a-gcp-project-name.iam.gserviceaccount.com'\n    }\n  }\n)\n```\n\nA name passed to `queue_as` will be used to identify which Cloud Tasks queue will be used by the job:\n\n```ruby\nclass GoodJob \u003c ApplicationJob\n  queue_as :a_queue_name\n\n  # ...\nend\n```\n\nMount the Rack application to set up an endpoint for performing jobs:\n\n```ruby\n# in config/routes.rb\nmount ActiveJob::GoogleCloudTasks::HTTP::Rack.new, at: '/_jobs'\n```\n\nNote that this rack app itself does not have any authentication mechanism.\n\n### Testing\n\nRequiring `active_job/google_cloud_tasks/http/inline` makes the adapter skip enqueueing jobs to Google Cloud Tasks. Once a job is enqueued, it will perform the job immediately.\n\n```ruby\nrequire 'active_job/google_cloud_tasks/http/inline' unless Rails.env.production?\n```\n\n#### Error when calling assets:precompile?\n\nWhen you call assets:precompile, all configs and initializers are loaded. If you load your credentials via environment variables they may not be available and the adapter initialization will cause errors. To solve this, wrap the `queue_adapter` config in a `unless ARGV.include?(\"assets:precompile\")` condition. e.g.:\n\n```ruby\nunless ARGV.include?(\"assets:precompile\") # prevents running on assets:precompile\n  Rails.application.config.active_job.queue_adapter = ActiveJob::GoogleCloudTasks::HTTP::Adapter.new(\n    project: 'my-project',\n    location: 'europe-west2',\n    url: 'https://www.example.com/jobs',\n    client: Google::Cloud::Tasks.cloud_tasks { |config|\n      # this will cause an error if the environment variable does not exist\n      config.credentials = JSON.parse(ENV[\"GOOGLE_CLOUD_PRODUCTION_KEYFILE\"])\n    }\n  )\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/esminc/activejob-google_cloud_tasks-http.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the ActiveJob::GoogleCloudTasks::HTTP project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/esminc/activejob-google_cloud_tasks-http/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesminc%2Factivejob-google_cloud_tasks-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesminc%2Factivejob-google_cloud_tasks-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesminc%2Factivejob-google_cloud_tasks-http/lists"}