Module org.refcodes.servicebus
Package org.refcodes.servicebus
Interface ServiceBus<S extends Service<?>>
- Type Parameters:
S
- the generic type
- All Known Implementing Classes:
SimpleServiceBus
public interface ServiceBus<S extends Service<?>>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasService
(ServiceMatcher<S> aServiceMatcher) Determines whether the givenServiceMatcher
will result in a singleService
to be looked up.lookupService
(ServiceMatcher<S> aServiceMatcher) Looks for a service matching the given service descriptor and returns it if found.
-
Method Details
-
lookupService
S lookupService(ServiceMatcher<S> aServiceMatcher) throws UnknownServiceRuntimeException, AmbiguousServiceRuntimeException Looks for a service matching the given service descriptor and returns it if found.- Parameters:
aServiceMatcher
- TheServiceMatcher
describing the service for which to look for.- Returns:
- The desired
ServiceConfigurationError
. - Throws:
UnknownServiceRuntimeException
- in case noService
matched.AmbiguousServiceRuntimeException
- in case more than oneService
matched theServiceMatcher
.
-
hasService
Determines whether the givenServiceMatcher
will result in a singleService
to be looked up. I.e. theServiceMatcher
must result in an unambiguousService
to be identified.- Parameters:
aServiceMatcher
- TheServiceMatcher
describing theService
for which to look for.- Returns:
- True in case if exactly one
Service
is matching the matcher. Else false is returned (either more than one service was identified or none service was identified).
-