Interface MicroserviceSubscriptionsService

All Known Implementing Classes:
MicroserviceSubscriptionsServiceImpl

public interface MicroserviceSubscriptionsService
This service gets microservice subscriptions and notifies listeners for MicroserviceSubscription*Event events.
  • Method Details

    • getTenant

      String getTenant()
      Returns current tenant.
      Returns:
      current tenant id
    • runForEachTenant

      void runForEachTenant(Runnable runnable)
      Invokes runnable in context of all subscribed tenants.
      Parameters:
      runnable - runnable to execute
    • runForTenant

      void runForTenant(String tenant, Runnable runnable)
      Invokes runnable in context of subscribed tenant.
      Parameters:
      tenant - tenant id
      runnable - runnable to execute
    • callForTenant

      <T> T callForTenant(String tenant, Callable<T> runnable)
      Invokes runnable in context of subscribed tenant.
      Type Parameters:
      T - generic type of expected result object
      Parameters:
      tenant - tenant id
      runnable - callable to execute
      Returns:
      result object
    • subscribe

      void subscribe()
      Fetches microservice subscriptions and emits MicroserviceSubscriptionRemovedEvent, MicroserviceSubscriptionAddedEvent to the MicroserviceChangedListener listeners

      If a listener throws exception during event execution, the event is created again in the next call to the method.

    • getAll

      Gets current microservice subscriptions' credentials
      Returns:
      collection of microservice credentials
    • getCredentials

      Optional<MicroserviceCredentials> getCredentials(String tenant)
      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()