activejob-google_cloud_pubsub | Google Cloud Pub/Sub adapter and worker for ActiveJob | GCP library
kandi X-RAY | activejob-google_cloud_pubsub Summary
kandi X-RAY | activejob-google_cloud_pubsub Summary
Google Cloud Pub/Sub adapter and worker for ActiveJob
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of activejob-google_cloud_pubsub
activejob-google_cloud_pubsub Key Features
activejob-google_cloud_pubsub Examples and Code Snippets
Rails.application.config.active_job.queue_adapter = :google_cloud_pubsub
class HelloJob < ApplicationJob
def perform(name)
puts "hello, #{name}!"
end
end
class HelloController < ApplicationController
def say
HelloJob.perform_lat
Rails.application.config.active_job.queue_adapter = ActiveJob::GoogleCloudPubsub::Adapter.new(
async: false,
logger: Rails.logger,
pubsub: Google::Cloud::Pubsub.new(
project_id: 'MY-PROJECT-ID',
credentials: 'path/to/keyfile.json'
Community Discussions
Trending Discussions on activejob-google_cloud_pubsub
QUESTION
I have a Rails ActiveJob that uses the gem activejob-google_cloud_pubsub. (Short usage tutorial). My application is deployed to AppEngine on a ruby flex environment. While my application works as expected, I am having difficulty scaling the worker services that consume the messages from Google Cloud PubSub. The gem's README docs mention a way to specify a Worker's max_threads from the terminal but not from within the rails app. As I am reading the gem's source code I see the initialize
for the worker takes in that variable max_threads
(which default to the number of cores). The problem is that I don't see how to initialize the worker with a default configuration so I can increase the thread number.
1 - How to initialize the activejob-google_cloud_pubsub
Worker with a higher number of threads?
2 - Would it be unadvisable to initialize the worker with more threads than processors in the machine?
Other Details:- I am deploying the worker on a separate service from the Rails Server by using a worker.yaml apart from the app.yaml
- The worker service is being scaled manually to 3 instances, still this are barely handling 10 messages per second (lean message processor, only log to output and return)
Any Input into how I can scale this type of queue processing would be helpful.
...ANSWER
Answered 2020-Jan-30 at 18:191 - How to initialize the activejob-google_cloud_pubsub Worker with a higher number of threads?
worker.yaml
Add the terminal flag --max_threads
as described in the gem's README
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install activejob-google_cloud_pubsub
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page