ursm / activejob-google_cloud_pubsub Goto Github PK
View Code? Open in Web Editor NEWGoogle Cloud Pub/Sub adapter and worker for ActiveJob
License: MIT License
Google Cloud Pub/Sub adapter and worker for ActiveJob
License: MIT License
In the spirit of how Rails handles exceptions in ActiveJobs I wonder if it might better to acknowledge a message right before the actual processing starts. Example:
message.acknowledge!
ActiveJob::Base.execute JSON.parse(message.data)
That way it is up to the user what to do with exceptions using retry_on
and discard_on
hooks.
After all I believe acknowledge
should mean delivered
, not processed
.
google-cloud-pubsub is starting a thread pool to process incoming messages:
@stream_pool.map do |stream|
Thread.new { stream.start }
end
activejob-google_cloud_pubsub is doing the same:
pool = Concurrent::ThreadPoolExecutor.new(min_threads: @min_threads, max_threads: @max_threads, max_queue: -1)
... effectively duplicating the efforts of google-cloud-pubsub, if I'm not mistaken?
Hello,
Firstly, thank you for this gem. I'm hoping to get some good use out of it.
I am attempting to use this gem in my app as a drop-in replacement for redis/sidekiq which is running background mail tasks.
Following the readme, I've setup the gem, and deployed the app. The application functions normally until a request to use the gem is fired. Specifically, I'm using devise to handle delivery of mail with the deliver_later
Code:
# Override Devise notification to use background messaging queue.
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
Running this line of code yields in the following:
NoMethodError (undefined method `enqueue' for ActiveJob::GoogleCloudPubsub::Adapter:Class):
Looking through the gem source, I can see that the method does indeed exist, however at runtime it appears it's not available. Are there any additional setup configs which are perhaps assumed or is there something I've missed which could cause this?
I'm running Ruby 2.5.3 and Rails 4.2.1
Thank you for any help. ๐
I'm actively looking at a move to Googe PubSub. I noticed travis is not setup:
https://travis-ci.org/ursm/activejob-google_cloud_pubsub
Is this gem being used in production?
If so, any current problems (such as latency or other)?
Thank you!
Hi,
There is a small incompatibility that causes the activejob-google_cloud_pubsub-worker daemon to fail when using with google-cloud-pubsub 0.27.0. Line 10 in pubsub_extension.rb (
autocreate: true
argument. That argument was removed in the latest release:I'm happy to issue a pr if you would like.
I get
/gems/signet-0.8.1/lib/signet/oauth_2/client.rb:988:in `fetch_access_token': Authorization failed. Server message: (Signet::AuthorizationError)
{
"error": "invalid_grant",
"error_description": "Bad Request"
}
when trying to start rails server while running emulator in development. I also get the following:
$ bundle exec activejob-google_cloud_pubsub-worker --project_id=dummy
Note: Google::Cloud::Logging is disabled because it failed to authorize with the service. (Authorization failed. Server message:
{
"error": "invalid_grant",
"error_description": "Bad Request"
}) Falling back to the default Rails logger.
Note: Google::Cloud::Debugger is disabled because it failed to authorize with the service. (Authorization failed. Server message:
{
"error": "invalid_grant",
"error_description": "Bad Request"
})
Note: Google::Cloud::ErrorReporting is disabled because it failed to authorize with the service. (Authorization failed. Server message:
{
"error": "invalid_grant",
"error_description": "Bad Request"
})
Note: Google::Cloud::Trace is disabled because it failed to authorize with the service. (Authorization failed. Server message:
{
"error": "invalid_grant",
"error_description": "Bad Request"
})
I guess I missed a step related to auth, however when I read the official docs they say no credentials etc necessary when using app engine. I also assumed the emulator wouldn't need auth? What am I missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.