Module: ActivePubsub::Publishable::ClassMethods
- Defined in:
- lib/active_pubsub/publishable.rb
Instance Method Summary collapse
- #exchange_key ⇒ Object
-
#publish_as(prefix) ⇒ Object
this is the publishing service namespace which will be used to build exchange name.
-
#publishable_actions(*actions) ⇒ Object
todo: make publishable actions filterable/appendable.
- #resource_routing_keys ⇒ Object
- #routing_key ⇒ Object
Instance Method Details
#exchange_key ⇒ Object
59 60 61 62 63 64 |
# File 'lib/active_pubsub/publishable.rb', line 59 def exchange_key [ try(:exchange_prefix) { ::ActivePubsub.config.try(:publish_as) }, name.demodulize.underscore ].flatten.compact.join(".") end |
#publish_as(prefix) ⇒ Object
this is the publishing service namespace which will be used to build exchange name
68 69 70 71 72 73 74 |
# File 'lib/active_pubsub/publishable.rb', line 68 def publish_as(prefix) self.exchange_prefix = prefix ::ActivePubsub::Publisher.start unless ::ActivePubsub::Publisher.started ::ActivePubsub.publisher.register_exchange(exchange_key) end |
#publishable_actions(*actions) ⇒ Object
todo: make publishable actions filterable/appendable
77 78 79 |
# File 'lib/active_pubsub/publishable.rb', line 77 def publishable_actions(*actions) @publishable_actions = actions end |
#resource_routing_keys ⇒ Object
85 86 87 |
# File 'lib/active_pubsub/publishable.rb', line 85 def resource_routing_keys [try(:exchange_prefix), name.demodulize.underscore].flatten.compact end |
#routing_key ⇒ Object
81 82 83 |
# File 'lib/active_pubsub/publishable.rb', line 81 def routing_key resource_routing_keys.join(".") end |