Interface Notifications2Api

All Known Implementing Classes:
Notifications2ApiImpl

public interface Notifications2Api
Simplified API for Notifications 2.0 that hides most of the complexity and allows easy usage of these features.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(Subscription.ID subscriptionId)
    Used to clean up platform resources created for given subscription.
    void
    disconnect(Subscription.ID subscriptionId, boolean unsubscribe)
    Closes server connection and stops given subscription

    If connection is not existing or not active, nothing will happen.
    Finds and returns low-level web socket object if one was created for subscription
    void
    subscribe(Subscription subscription, NotificationListener listener)
    Makes new subscription based on requested definition.
  • Method Details

    • subscribe

      void subscribe(Subscription subscription, NotificationListener listener)
      Makes new subscription based on requested definition.

      If connection is already existing and active, Notifications2SubscriptionAlreadyEstablishedException will be thrown
      Parameters:
      subscription - subscription definition
      listener - notification listener
    • disconnect

      void disconnect(Subscription.ID subscriptionId, boolean unsubscribe)
      Closes server connection and stops given subscription

      If connection is not existing or not active, nothing will happen.
      Parameters:
      subscriptionId - subscription identifier to unsubscribe
      unsubscribe - true if token should be unsubscribed (only taken into account for persistent targets)
    • delete

      void delete(Subscription.ID subscriptionId)
      Used to clean up platform resources created for given subscription.

      WARNING! Please be aware that deleting subscription will close all of its connections - even from other applications (i.e. instances of the same microservice).
      Parameters:
      subscriptionId - subscription identifier to delete
    • getRawWebSocket

      Optional<Object> getRawWebSocket(Subscription.ID subscriptionId)
      Finds and returns low-level web socket object if one was created for subscription
      Parameters:
      subscriptionId - subscription identifier