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 intoFeature
. 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 aConfigurationError
to theConfigurationErrorHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IBusConfiguration.Properties
A collection of properties commonly used by different parts of the library.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IBusConfiguration
addFeature(Feature feature)
Add a feature to the given configuration, replacing any existing feature of the same type.BusConfiguration
addPublicationErrorHandler(IPublicationErrorHandler handler)
Add a handler that will be called whenever a publication error occurs.<T extends Feature>
TgetFeature(java.lang.Class<T> feature)
Get a registered feature by its type (class).<T> T
getProperty(java.lang.String name, T defaultValue)
Read a property from this configuration.java.util.Collection<IPublicationErrorHandler>
getRegisteredPublicationErrorHandlers()
Get an unmodifiable collection of all registered publication error handlersboolean
hasProperty(java.lang.String name)
Check whether a property has been set.IBusConfiguration
setProperty(java.lang.String name, java.lang.Object value)
Set a property which will be read by the message bus constructor.
-
-
-
Method Detail
-
setProperty
IBusConfiguration setProperty(java.lang.String name, java.lang.Object value)
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
<T> T getProperty(java.lang.String name, T defaultValue)
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
boolean hasProperty(java.lang.String name)
Check whether a property has been set.- Returns:
- true if property was set (even if set to null) false otherwise
-
getFeature
<T extends Feature> T getFeature(java.lang.Class<T> feature)
Get a registered feature by its type (class).
-
addFeature
IBusConfiguration addFeature(Feature feature)
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
BusConfiguration addPublicationErrorHandler(IPublicationErrorHandler handler)
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
java.util.Collection<IPublicationErrorHandler> getRegisteredPublicationErrorHandlers()
Get an unmodifiable collection of all registered publication error handlers
-
-