Module: Messaging
- Defined in:
- lib/messaging.rb,
lib/messaging/cli.rb,
lib/messaging/config.rb,
lib/messaging/routes.rb,
lib/messaging/message.rb,
lib/messaging/publish.rb,
lib/messaging/routing.rb,
lib/messaging/version.rb,
lib/messaging/adapters.rb,
lib/messaging/config_23.rb,
lib/messaging/middleware.rb,
lib/messaging/routing_23.rb,
lib/messaging/adapters/test.rb,
lib/messaging/rails/railtie.rb,
lib/messaging/resque_worker.rb,
lib/messaging/routing/route.rb,
lib/messaging/adapters/kafka.rb,
lib/messaging/sidekiq_worker.rb,
lib/messaging/instrumentation.rb,
lib/messaging/expected_version.rb,
lib/messaging/adapters/postgres.rb,
lib/messaging/exception_handler.rb,
lib/messaging/message/from_json.rb,
lib/messaging/adapters/test/store.rb,
lib/messaging/consumer_supervisor.rb,
lib/messaging/adapters/test/stream.rb,
lib/messaging/adapters/test/category.rb,
lib/messaging/adapters/test/consumer.rb,
lib/messaging/routing/enqueued_route.rb,
lib/messaging/adapters/kafka/consumer.rb,
lib/messaging/adapters/kafka/producer.rb,
lib/messaging/adapters/postgres/store.rb,
lib/messaging/routing/message_matcher.rb,
lib/messaging/adapters/postgres/stream.rb,
lib/messaging/adapters/test/categories.rb,
lib/messaging/middleware/rails_wrapper.rb,
lib/messaging/rails/postgres_xid8_type.rb,
lib/messaging/adapters/postgres/streams.rb,
lib/messaging/adapters/postgres/category.rb,
lib/messaging/adapters/postgres/consumer.rb,
lib/messaging/adapters/postgres/categories.rb,
lib/messaging/adapters/postgres/create_lock.rb,
lib/messaging/adapters/postgres/release_lock.rb,
lib/messaging/routing/enqueue_message_handler.rb,
lib/messaging/adapters/postgres/categories/row.rb,
lib/messaging/adapters/postgres/serialized_message.rb,
lib/messaging/adapters/postgres/category_with_partitions.rb,
lib/messaging/middleware/after_active_record_transaction.rb,
lib/messaging/adapters/postgres/advisory_transaction_lock.rb
Defined Under Namespace
Modules: Adapters, Instrumentation, Message, Middleware, Rails, Routing
Classes: CLI, Config, ConsumerSupervisor, ExceptionHandler, ExpectedVersion, Publish, ResqueWorker, Routes, SidekiqWorker
Constant Summary
collapse
- VERSION =
'4.0.11'.freeze
Class Method Summary
collapse
Class Method Details
.[](adapter) ⇒ Object
58
59
60
|
# File 'lib/messaging.rb', line 58
def self.[](adapter)
Adapters[adapter]
end
|
.all_messages ⇒ Object
105
106
107
|
# File 'lib/messaging.rb', line 105
def self.all_messages
message_store.messages
end
|
Access the stream categories in the current message store
88
89
90
|
# File 'lib/messaging.rb', line 88
def self.categories
message_store.categories
end
|
.category(name) ⇒ Object
92
93
94
|
# File 'lib/messaging.rb', line 92
def self.category(name)
message_store.category(name)
end
|
.config ⇒ Object
38
39
40
|
# File 'lib/messaging.rb', line 38
def self.config
Config.config
end
|
.consumer_adapter ⇒ Object
46
47
48
|
# File 'lib/messaging.rb', line 46
def self.consumer_adapter
Adapters[Config.consumer.adapter]
end
|
.defined_messages ⇒ Object
109
110
111
|
# File 'lib/messaging.rb', line 109
def self.defined_messages
ObjectSpace.each_object(Class).select { |c| c.included_modules.include? Messaging::Message }
end
|
.in_consumer_mode? ⇒ Boolean
113
114
115
|
# File 'lib/messaging.rb', line 113
def self.in_consumer_mode?
File.basename($PROGRAM_NAME) == 'messaging'
end
|
.inline!(&block) ⇒ Object
66
67
68
|
# File 'lib/messaging.rb', line 66
def self.inline!(&block)
routes.inline!(&block)
end
|
.logger ⇒ Object
42
43
44
|
# File 'lib/messaging.rb', line 42
def self.logger
Config.logger
end
|
.messages_in_streams(*streams) ⇒ Object
101
102
103
|
# File 'lib/messaging.rb', line 101
def self.messages_in_streams(*streams)
message_store.messages_in_streams(*streams)
end
|
.routes ⇒ Object
62
63
64
|
# File 'lib/messaging.rb', line 62
def self.routes
@routes ||= Routes.new
end
|
.setup(&block) ⇒ Object
34
35
36
|
# File 'lib/messaging.rb', line 34
def self.setup(&block)
Config.setup(&block)
end
|
.stream(name) ⇒ Object
96
97
98
99
|
# File 'lib/messaging.rb', line 96
def self.stream(name)
name = name.stream_name if name.respond_to?(:stream_name)
message_store.stream(name)
end
|
.without_dispatch(&block) ⇒ Object
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/messaging.rb', line 70
def self.without_dispatch(&block)
current_dispatcher = Config.dispatcher.adapter
Config.dispatcher.adapter = :null_adapter
result = block.call
ensure
Config.dispatcher.adapter = current_dispatcher
result
end
|