Module: Artsy::EventPublisher
- Defined in:
- lib/artsy/event_publisher.rb,
lib/artsy/event_publisher/version.rb
Defined Under Namespace
Modules: Config
Classes: Connection, Error
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
26
27
28
29
|
# File 'lib/artsy/event_publisher.rb', line 26
def self.configure
yield Config if block_given?
Config
end
|
.publish(topic, routing_key = "", subject: nil, verb: nil, object: nil, properties: nil) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/artsy/event_publisher.rb', line 11
def self.publish(topic, routing_key = "", subject: nil, verb: nil, object: nil, properties: nil)
return unless Config.enabled
data = {
subject: subject,
verb: verb,
object: object,
properties: properties
}.compact
payload = data.to_json
Connection.publish(topic: topic, routing_key: routing_key, payload: payload)
Config.logger&.debug("[event] #{payload}")
data
end
|