Module: Cloudenvoy
- Defined in:
- lib/cloudenvoy.rb,
lib/cloudenvoy/topic.rb,
lib/cloudenvoy/config.rb,
lib/cloudenvoy/engine.rb,
lib/cloudenvoy/message.rb,
lib/cloudenvoy/testing.rb,
lib/cloudenvoy/version.rb,
lib/cloudenvoy/publisher.rb,
lib/cloudenvoy/subscriber.rb,
lib/cloudenvoy/subscription.rb,
lib/cloudenvoy/authenticator.rb,
lib/cloudenvoy/logger_wrapper.rb,
lib/cloudenvoy/pub_sub_client.rb,
lib/cloudenvoy/middleware/chain.rb,
lib/cloudenvoy/publisher_logger.rb,
lib/cloudenvoy/subscriber_logger.rb,
lib/cloudenvoy/authentication_error.rb,
lib/cloudenvoy/backend/google_pub_sub.rb,
lib/cloudenvoy/backend/memory_pub_sub.rb,
lib/cloudenvoy/invalid_subscriber_error.rb,
lib/generators/cloudenvoy/publisher_generator.rb,
lib/generators/cloudenvoy/subscriber_generator.rb,
app/controllers/cloudenvoy/subscriber_controller.rb
Overview
Define and manage Cloud Pub/Sub publishers and subscribers
Defined Under Namespace
Modules: Authenticator, Backend, Generators, Middleware, Publisher, Subscriber, Testing Classes: AuthenticationError, Config, Engine, InvalidSubscriberError, LoggerWrapper, Message, PubSubClient, PublisherLogger, SubscriberController, SubscriberLogger, Subscription, Topic
Constant Summary collapse
- VERSION =
'0.6.0'
Instance Attribute Summary collapse
-
#config ⇒ Object
writeonly
Sets the attribute config.
Class Method Summary collapse
-
.config ⇒ Cloudenvoy::Config
Return the Cloudenvoy configuration.
-
.configure {|config| ... } ⇒ Object
Cloudenvoy configurator.
-
.logger ⇒ Logger
Return the Cloudenvoy logger.
-
.publish(topic, payload, attrs = {}) ⇒ Cloudenvoy::Message
Publish a message to a topic.
-
.publish_all(topic, msg_args) ⇒ Array<Cloudenvoy::Message>
Publish multiple messages to a topic.
-
.publishers ⇒ Set<Cloudenvoy::Subscriber>
Return the list of registered publishers.
-
.setup_publishers ⇒ Array<Cloudenvoy::Subscription>
Create/update default topics for all registered publishers.
-
.setup_subscribers ⇒ Array<Cloudenvoy::Subscription>
Create/update subscriptions for all registered subscribers.
-
.subscribers ⇒ Set<Cloudenvoy::Subscriber>
Return the list of registered subscribers.
Instance Attribute Details
#config=(value) ⇒ Object (writeonly)
Sets the attribute config
26 27 28 |
# File 'lib/cloudenvoy.rb', line 26 def config=(value) @config = value end |
Class Method Details
.config ⇒ Cloudenvoy::Config
Return the Cloudenvoy configuration.
40 41 42 |
# File 'lib/cloudenvoy.rb', line 40 def self.config @config ||= Config.new end |
.configure {|config| ... } ⇒ Object
Cloudenvoy configurator.
31 32 33 |
# File 'lib/cloudenvoy.rb', line 31 def self.configure yield(config) end |
.logger ⇒ Logger
Return the Cloudenvoy logger.
49 50 51 |
# File 'lib/cloudenvoy.rb', line 49 def self.logger config.logger end |
.publish(topic, payload, attrs = {}) ⇒ Cloudenvoy::Message
Publish a message to a topic. Shorthand method to Cloudenvoy::PubSubClient#publish.
62 63 64 |
# File 'lib/cloudenvoy.rb', line 62 def self.publish(topic, payload, attrs = {}) PubSubClient.publish(topic, payload, attrs) end |
.publish_all(topic, msg_args) ⇒ Array<Cloudenvoy::Message>
Publish multiple messages to a topic. Shorthand method to Cloudenvoy::PubSubClient#publish_all.
74 75 76 |
# File 'lib/cloudenvoy.rb', line 74 def self.publish_all(topic, msg_args) PubSubClient.publish_all(topic, msg_args) end |
.publishers ⇒ Set<Cloudenvoy::Subscriber>
Return the list of registered publishers.
83 84 85 |
# File 'lib/cloudenvoy.rb', line 83 def self.publishers @publishers ||= Set.new end |
.setup_publishers ⇒ Array<Cloudenvoy::Subscription>
Create/update default topics for all registered publishers.
110 111 112 |
# File 'lib/cloudenvoy.rb', line 110 def self.setup_publishers publishers.flat_map(&:setup) end |
.setup_subscribers ⇒ Array<Cloudenvoy::Subscription>
Create/update subscriptions for all registered subscribers.
101 102 103 |
# File 'lib/cloudenvoy.rb', line 101 def self.setup_subscribers subscribers.flat_map(&:setup) end |
.subscribers ⇒ Set<Cloudenvoy::Subscriber>
Return the list of registered subscribers.
92 93 94 |
# File 'lib/cloudenvoy.rb', line 92 def self.subscribers @subscribers ||= Set.new end |