Class Subscription

java.lang.Object
com.cumulocity.sdk.client.notification2.Subscription

public class Subscription extends Object
This class represents a subscription definition. It can be created only using a Subscription.Builder object.

We assume that there are 2 types of targets:

A valid subscription definition must contain:
  • subscriptionName - name of the subscription; it must be unique in the scope of given subscriber (see below)
  • subscriber - name of service that uses notifications API. If the service has many instances, there can be 2 strategies:
    • subscriber name can be shared between instances - this is perfect for SHARED subscriptions, where notifications will be automatically load-balanced between service instances
    • subscriber name can be unique - perfect for NON-SHARED subscriptions - every instance will be notified about every notification
  • targetApis - at least one device or tenant target API must be provided
  • deviceId - required only when device context is set
  • ackMode - see AckMode - default value is AckMode.IMMEDIATE
  • tenantId - tenant ID
  • shared - default false - if subscription is shared between many cluster members (same subscriber and subscription definition) notifications will be balanced between those members (single notification will be sent to only one member). Not shared subscription will always receive all notifications. Shared members MUST have the same subscriber name
  • typeFilter - optional type of the object (i.e. event type) - notifications should come only for objects of this type. It can be a single value, or a limited (supporting only or) OData expression i.e. 'c8y_Temperature' or 'c8y_Pressure'
  • Method Details

    • isTenantSubscription

      public boolean isTenantSubscription()
    • getTargetApis

      public Set<String> getTargetApis()
    • builder

      public static Subscription.Builder builder()