Package net.engio.mbassy.bus.config
Interface IBusConfiguration
- All Known Implementing Classes:
BusConfiguration
public interface IBusConfiguration
The configuration of message bus instances is feature driven, e.g. configuration parameters
are grouped into
Feature
.
Each bus will look for the features it requires and configure them according to the provided configuration.
If a required feature is not found the bus will publish a ConfigurationError
to the ConfigurationErrorHandler
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
A collection of properties commonly used by different parts of the library. -
Method Summary
Modifier and TypeMethodDescriptionaddFeature
(Feature feature) Add a feature to the given configuration, replacing any existing feature of the same type.Add a handler that will be called whenever a publication error occurs.<T extends Feature>
TgetFeature
(Class<T> feature) Get a registered feature by its type (class).<T> T
getProperty
(String name, T defaultValue) Read a property from this configuration.Get an unmodifiable collection of all registered publication error handlersboolean
hasProperty
(String name) Check whether a property has been set.setProperty
(String name, Object value) Set a property which will be read by the message bus constructor.
-
Method Details
-
setProperty
Set a property which will be read by the message bus constructor. Existing value will be overwritten. Null values are supported (checking for existence of property will returntrue
even if set tonull
).- Parameters:
name
- The name of the property. Note: Each implementation may support different properties.value
- The value of the property.- Returns:
- A reference to
this
bus configuration.
-
getProperty
Read a property from this configuration.- Type Parameters:
T
- The type of property- Parameters:
name
- The name of the property to be read.defaultValue
- The value to be returned if property was not found- Returns:
- The value associated with the given property name or
defaultValue
if not present
-
hasProperty
Check whether a property has been set.- Returns:
- true if property was set (even if set to null) false otherwise
-
getFeature
Get a registered feature by its type (class). -
addFeature
Add a feature to the given configuration, replacing any existing feature of the same type.- Parameters:
feature
- The feature to add- Returns:
- A reference to
this
bus configuration.
-
addPublicationErrorHandler
Add a handler that will be called whenever a publication error occurs. SeePublicationError
- Parameters:
handler
- The handler to be added to the list of handlers- Returns:
- A reference to
this
bus configuration.
-
getRegisteredPublicationErrorHandlers
Collection<IPublicationErrorHandler> getRegisteredPublicationErrorHandlers()Get an unmodifiable collection of all registered publication error handlers
-