Class: Qs::DispatchJob
- Inherits:
-
Job
show all
- Defined in:
- lib/qs/dispatch_job.rb
Constant Summary
Constants inherited
from Job
Job::PAYLOAD_TYPE
Instance Attribute Summary
Attributes inherited from Job
#created_at, #name
Attributes inherited from Message
#params, #payload_type
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Job
#==, #inspect, #route_name
Methods inherited from Message
#route_id, #route_name
Constructor Details
#initialize(event_channel, event_name, options = nil) ⇒ DispatchJob
Returns a new instance of DispatchJob.
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/qs/dispatch_job.rb', line 17
def initialize(event_channel, event_name, options = nil)
options ||= {}
event_params = options.delete(:event_params) || {}
event_publisher = options.delete(:event_publisher) || Qs.event_publisher
options[:params] = {
'event_channel' => event_channel,
'event_name' => event_name,
'event_params' => event_params,
'event_publisher' => event_publisher
}
super(Qs.dispatcher_job_name, options)
end
|
Class Method Details
.event(job) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/qs/dispatch_job.rb', line 9
def self.event(job)
Qs::Event.new(job.params['event_channel'], job.params['event_name'], {
:params => job.params['event_params'],
:publisher => job.params['event_publisher'],
:published_at => job.created_at
})
end
|
Instance Method Details
#event ⇒ Object
30
31
32
|
# File 'lib/qs/dispatch_job.rb', line 30
def event
@event ||= self.class.event(self)
end
|