EventBus Service¶
This core service handles subscriptions and publications. It may be replaced by a facade to an existing event bus/mq manager.
It exposes user-facing endpoints that are used by other services to subscribe to events and publish events.
There are five service-specific configuration file options.
Environment variables¶
You can set the EVENTBUS_DEBUG_LEVEL
(all upper-cased) or DEBUG_LEVEL
environment variables
to DEBUG
to add additional information in the console for the launched service. It defaults to
INFO
. (Please note that setting DEBUG_LEVEL
to DEBUG
will produce tons of logs.)
The possible values are NOTSET
, DEBUG
, INFO
, WARNING
, ERROR
, and FATAL
. Those values
are from the most verbose, NOTSET
, which shows all logs, to the least verbose, FATAL
, which
only shows fatal errors.
If EVENTBUS_DEBUG_LEVEL
is not defined then the value of DEBUG_LEVEL
is used (or INFO
if
DEBUG_LEVEL
is not defined either).
Access logs are only shown at NOTSET
and DEBUG
levels.
Configuration file¶
This service has a configuration file (eventbus.yaml
by default) that describes the host,
port, ssl_context, and trusted_authorities to use. It can also enable insecure
logins.
If no configuration file is found it will default to the following values:
apiVersion: opentestfactory.org/v1alpha1
kind: EventBusConfig
current-context: default
contexts:
- context:
port: 38368
host: 127.0.0.1
ssl_context: adhoc
enable_insecure_login: false
max_publication_attempts: 2
max_publication_threads: 10
max_deadletter_threads: 1
post_timeout_seconds: 10
max_quarantine_attempts: 10
name: default
The configuration included in the ‘allinone’ image is described in “Common settings.” The
listening port is 38368
and the bind address is 0.0.0.0
as the service exposes user-facing endpoints.
Five service-specific configuration options can be refined.
EventBus limits¶
All those limits must be integers. If the entry is missing, the default value will be assumed. They must be defined in the currently-used context.
max_publication_attempts
¶
max_publication_attempts
limits the number of attempts the event bus makes to send a publication
to a subscriber. It must be at least 1. If not specified, defaults to 2.
The event bus only attempts to re-send a publication to a subscriber if the previous attempt failed. Please note that if the subscriber returned a 4xx or 5xx error code it is considered a failure.
max_publication_threads
¶
max_publication_threads
limits the number of simultaneous publication threads. It must be at
least 1. If not specified, defaults to 10.
Each publication received by the event bus is dispatched to the relevant subscribers in its own thread. Increasing this number means more publications can be dispatched in parallel.
If all publication threads are in use, the pending publications are queued and will be dispatched when publication threads become available.
max_deadletter_threads
¶
max_deadletter_threads
limits the number of simultaneous publication replay threads. It must
be at least 1. If not specified, defaults to 1.
Those threads are used to dispatch publications that failed during their first dispatch attempt.
If all deadletter threads are in use, the pending republications are queued and will be dispatched when deadletter threads become available.
post_timeout_seconds
¶
post_timeout_seconds
limits the time the event bus waits for a subscriber to respond to a
publication. It must be at least 1. If not specified, defaults to 10.
If the subscriber does not respond within the specified time, the publication dispatch is considered a failure and will be replayed if the maximum publication attempt has not been reached.
max_quarantine_attempts
¶
max_quarantine_attempts
limits the number of attempts the event bus makes to send a
publication to a subscriber that failed to respond to a previous publication. It must be at
least 1. If not specified, defaults to 10.
If the number of consecutive failed delivery attempts exceeds this limit, the subscriber is quarantined.
The event bus does not attempt to dispatch publications to quarantined subscribers.
Launch command¶
If you want to manually start the event bus service, use the following command:
python -m opentf.core.eventbus [--context context] [--config configfile]
Additional command-line options are available and described in “Command-line options.”