Module: Mumukit::Nuntius
- Extended by:
- Core::Configurable
- Defined in:
- lib/mumukit/nuntius.rb,
lib/mumukit/nuntius/version.rb
Defined Under Namespace
Modules: Consumer, EventConsumer, EventPublisher, JobConsumer, JobPublisher, NotificationMode, Publisher, TaskConsumer Classes: Connection
Constant Summary collapse
- Logger =
::Logger.new('nuntius.log')
- VERSION =
'6.7.1'
Class Method Summary collapse
- .defaults ⇒ Object
- .ensure_connection ⇒ Object
- .establish_connection ⇒ Object
-
.notify!(queue_name, message) ⇒ Object
Notifies a message to a given queue.
-
.notify_event!(type, event, **options) ⇒ Object
Notifies an event of the given type.
-
.notify_job!(type, job) ⇒ Object
Notifies a job of the given type.
Class Method Details
.defaults ⇒ Object
12 13 14 15 16 |
# File 'lib/mumukit/nuntius.rb', line 12 def self.defaults struct.tap do |config| config.notification_mode = Mumukit::Nuntius::NotificationMode.from_env end end |
.ensure_connection ⇒ Object
76 77 78 |
# File 'lib/mumukit/nuntius.rb', line 76 def self.ensure_connection establish_connection rescue nil end |
.establish_connection ⇒ Object
72 73 74 |
# File 'lib/mumukit/nuntius.rb', line 72 def self.establish_connection notification_mode.establish_connection end |
.notify!(queue_name, message) ⇒ Object
Notifies a message to a given queue.
Messages are consumed using the Mumukit::Nuntius::Consumer module
24 25 26 |
# File 'lib/mumukit/nuntius.rb', line 24 def self.notify!(queue_name, ) notification_mode.notify! queue_name, end |
.notify_event!(type, event, **options) ⇒ Object
Notifies an event of the given type.
Events are very similar to normal messages, with the following differences:
* they are published to a single queue, named `events`
* event data is augmented with the sender app name,
so that consumers can discard events sent from themselves.
This makes events lighter and easier to send. You should send application events to here unless:
* you expect to send alot of those events
* you expect those events processing to be slow
Events are consumed using the Mumukit::Nuntius::EventConsumer module
46 47 48 |
# File 'lib/mumukit/nuntius.rb', line 46 def self.notify_event!(type, event, **) notification_mode.notify_event! type, event, ** end |
.notify_job!(type, job) ⇒ Object
Notifies a job of the given type.
Jobs are very similar to normal messages, with the following differences:
* they are published to a single queue, named `jobs`
* job data is augmented with the sender app name,
so that consumers can consume only jobs sent from themselves.
This makes jobs lighter and easier to send. You should send application jobs to here if:
* you expect to send a lot of those jobs
* you expect those jobs processing to be slow
Events are consumed using the Mumukit::Nuntius::JobConsumer module
68 69 70 |
# File 'lib/mumukit/nuntius.rb', line 68 def self.notify_job!(type, job) notification_mode.notify_job! type, job end |