Class: ActiveJob::QueueAdapters::PubSubAdapter
- Inherits:
-
Object
- Object
- ActiveJob::QueueAdapters::PubSubAdapter
- Defined in:
- lib/pubilion/extensions/active_job/queue_adapter.rb
Overview
Cloud Pub/Sub Queue Adapter for ActiveJob
Instance Method Summary collapse
-
#enqueue(job) ⇒ Object
Enqueue a job to Cloud Pub/Sub.
-
#enqueue_at(_job, _timestamp) ⇒ Object
THIS METHOD IS NOT SUPPORTED.
Instance Method Details
#enqueue(job) ⇒ Object
Enqueue a job to Cloud Pub/Sub.
11 12 13 14 15 16 |
# File 'lib/pubilion/extensions/active_job/queue_adapter.rb', line 11 def enqueue(job) topic = client.find_topic(job.queue_name) raise Pubilion::TopicNotFound, "Topic not found: #{job.queue_name}" if topic.nil? topic.publish(job.serialize.to_json) end |
#enqueue_at(_job, _timestamp) ⇒ Object
THIS METHOD IS NOT SUPPORTED. Always raise Pubilion::NotSupported. Because PubSub does not support job scheduling. If you need to schedule jobs, use a Cloud Tasks or other QueueAdapter.
22 23 24 25 26 27 |
# File 'lib/pubilion/extensions/active_job/queue_adapter.rb', line 22 def enqueue_at(_job, ) raise Pubilion::NotSupported, " PubSub does not support job scheduling.\n If you need to schedule jobs, use a Cloud Tasks or other QueueAdapter.\n MSG\nend\n" |