Interface MicroserviceSubscriptionsService
- All Known Implementing Classes:
MicroserviceSubscriptionsServiceImpl
public interface MicroserviceSubscriptionsService
This service gets microservice subscriptions and notifies listeners for MicroserviceSubscription*Event events.
-
Method Summary
Modifier and TypeMethodDescription<T> T
callForTenant
(String tenant, Callable<T> runnable) Invokes runnable in context of subscribed tenant.getAll()
Gets current microservice subscriptions' credentialsgetCredentials
(String tenant) Gets microservice credentials of the given tenantReturns current tenant.boolean
void
runForEachTenant
(Runnable runnable) Invokes runnable in context of all subscribed tenants.void
runForTenant
(String tenant, Runnable runnable) Invokes runnable in context of subscribed tenant.void
Fetches microservice subscriptions and emits MicroserviceSubscriptionRemovedEvent, MicroserviceSubscriptionAddedEvent to the MicroserviceChangedListener listeners
-
Method Details
-
getTenant
String getTenant()Returns current tenant.- Returns:
- current tenant id
-
runForEachTenant
Invokes runnable in context of all subscribed tenants.- Parameters:
runnable
- runnable to execute
-
runForTenant
Invokes runnable in context of subscribed tenant.- Parameters:
tenant
- tenant idrunnable
- runnable to execute
-
callForTenant
Invokes runnable in context of subscribed tenant.- Type Parameters:
T
- generic type of expected result object- Parameters:
tenant
- tenant idrunnable
- callable to execute- Returns:
- result object
-
subscribe
void subscribe()Fetches microservice subscriptions and emits MicroserviceSubscriptionRemovedEvent, MicroserviceSubscriptionAddedEvent to the MicroserviceChangedListener listenersIf a listener throws exception during event execution, the event is created again in the next call to the method.
-
getAll
Collection<MicroserviceCredentials> getAll()Gets current microservice subscriptions' credentials- Returns:
- collection of microservice credentials
-
getCredentials
Gets microservice credentials of the given tenant- Parameters:
tenant
- tenant id- Returns:
Optional.of
microservice credentials if tenant is found in current subscriptions;Optional.<MicroserviceCredentials>empty()
otherwise
-
isRegisteredSuccessfully
boolean isRegisteredSuccessfully()
-