Class: ResourceSubscriber::Publisher
- Inherits:
-
Object
- Object
- ResourceSubscriber::Publisher
- Includes:
- AutoInject
- Defined in:
- lib/resource_subscriber/publisher.rb
Instance Method Summary collapse
- #publish_as(routing_key) {|self.config| ... } ⇒ Object
- #publish_resource_message(action, resource) ⇒ Object
Methods included from AutoInject
Instance Method Details
#publish_as(routing_key) {|self.config| ... } ⇒ Object
12 13 14 15 |
# File 'lib/resource_subscriber/publisher.rb', line 12 def publish_as(routing_key) yield(self.config) if block_given? self.config.routing_key = routing_key end |
#publish_resource_message(action, resource) ⇒ Object
7 8 9 10 |
# File 'lib/resource_subscriber/publisher.rb', line 7 def (action, resource) = ::ResourceSubscriber::Message.new(resource) ::ActionSubscriber::Publisher.publish_async("#{self.config.routing_key}.#{action}", .to_json, self.config.exchange, self.config.) end |