Module: Eventboss
- Defined in:
- lib/generators/eventboss/listener/listener_generator.rb,
lib/eventboss.rb,
lib/eventboss/cli.rb,
lib/eventboss/queue.rb,
lib/eventboss/topic.rb,
lib/eventboss/runner.rb,
lib/eventboss/sender.rb,
lib/eventboss/worker.rb,
lib/eventboss/fetcher.rb,
lib/eventboss/logging.rb,
lib/eventboss/version.rb,
lib/eventboss/launcher.rb,
lib/eventboss/listener.rb,
lib/eventboss/publisher.rb,
lib/eventboss/middleware.rb,
lib/eventboss/sns_client.rb,
lib/eventboss/long_poller.rb,
lib/eventboss/safe_thread.rb,
lib/eventboss/unit_of_work.rb,
lib/eventboss/configuration.rb,
lib/eventboss/queue_listener.rb,
lib/eventboss/instrumentation.rb,
lib/eventboss/development_mode.rb,
lib/eventboss/error_handlers/logger.rb,
lib/eventboss/error_handlers/sentry.rb,
lib/eventboss/error_handlers/rollbar.rb,
lib/eventboss/error_handlers/airbrake.rb,
lib/eventboss/error_handlers/db_connection_drop_handler.rb,
lib/eventboss/error_handlers/non_existent_queue_handler.rb,
lib/eventboss/error_handlers/db_connection_not_established_handler.rb
Overview
Creates the Eventboss listener scaffold
Defined Under Namespace
Modules: DevelopmentMode, ErrorHandlers, Instrumentation, Listener, Logging, Middleware, SafeThread
Classes: CLI, Configuration, Fetcher, Launcher, ListenerGenerator, LongPoller, NotConfigured, Publisher, Queue, QueueListener, Railtie, Runner, Sender, SnsClient, Topic, UnitOfWork, Worker
Constant Summary
collapse
- Shutdown =
Class.new(StandardError)
- VERSION =
"1.9.0"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
82
83
84
|
# File 'lib/eventboss.rb', line 82
def configuration
@_configuration ||= Configuration.new
end
|
78
79
80
|
# File 'lib/eventboss.rb', line 78
def configure
yield configuration if block_given?
end
|
.env ⇒ Object
74
75
76
|
# File 'lib/eventboss.rb', line 74
def env
@env ||= ENV['EVENTBOSS_ENV'] || ENV['EVENTBUS_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV']
end
|
.logger ⇒ Object
86
87
88
|
# File 'lib/eventboss.rb', line 86
def logger
Thread.current[:ah_eventboss_logger] ||= configuration.logger
end
|
.publisher(event_name, opts = {}) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/eventboss.rb', line 38
def publisher(event_name, opts = {})
sns_client = configuration.sns_client
if configuration.development_mode?
source_app = configuration.eventboss_app_name unless opts[:generic]
topic_name = Topic.build_name(event_name: event_name, source_app: source_app)
sns_client.create_topic(name: topic_name)
end
Publisher.new(event_name, sns_client, configuration, opts)
end
|
.sender(event_name, destination, options = {}) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/eventboss.rb', line 50
def sender(event_name, destination, options = {})
source_app = configuration.eventboss_app_name unless options[:generic]
queue = Queue.build(
destination: destination,
source_app: source_app,
event_name: event_name,
env: env
)
sqs_client = configuration.sqs_client
if configuration.development_mode?
sqs_client.create_queue(queue_name: queue.name)
end
Sender.new(
client: sqs_client,
queue: queue
)
end
|