Package joynr
Class OnChangeWithKeepAliveSubscriptionQos
- java.lang.Object
-
- io.joynr.pubsub.SubscriptionQos
-
- joynr.UnicastSubscriptionQos
-
- joynr.OnChangeSubscriptionQos
-
- joynr.OnChangeWithKeepAliveSubscriptionQos
-
- All Implemented Interfaces:
HeartbeatSubscriptionInformation,JoynrType,Serializable
public class OnChangeWithKeepAliveSubscriptionQos extends OnChangeSubscriptionQos implements HeartbeatSubscriptionInformation
Class representing the quality of service settings for subscriptions based on changes and time periods
This class stores quality of service settings used for subscriptions to attributes in generated proxy objects. Using it for subscriptions to broadcasts is theoretically possible because of inheritance but makes no sense (in this case the additional members will be ignored).
Notifications will be sent if the subscribed value has changed or a time interval without notifications has expired. The subscription will automatically expire after the expiry date is reached. If no publications were received for alertAfter Interval, publicationMissed will be called.
minInterval can be used to prevent too many messages being sent.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class joynr.UnicastSubscriptionQos
DEFAULT_PUBLICATION_TTL_MS, MAX_PUBLICATION_TTL_MS, MIN_PUBLICATION_TTL_MS
-
Fields inherited from class io.joynr.pubsub.SubscriptionQos
IGNORE_VALUE, INFINITE_SUBSCRIPTION, NO_EXPIRY_DATE
-
-
Constructor Summary
Constructors Constructor Description OnChangeWithKeepAliveSubscriptionQos()Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAlertAfterInterval()booleanequals(Object obj)Check for equalitylonggetAlertAfterIntervalMs()Get the alertAfterInterval in milliseconds.longgetMaxIntervalMs()Get the maximum interval in milliseconds.longgetPeriodMs()Get the maximum interval in milliseconds.inthashCode()Calculate code for hashing based on member contents and superclassOnChangeWithKeepAliveSubscriptionQossetAlertAfterIntervalMs(long alertAfterIntervalMs)Set the alertAfterInterval in milliseconds.OnChangeWithKeepAliveSubscriptionQossetExpiryDateMs(long expiryDateMs)Set the end date of the subscription, in milliseconds (since 1970-01-01T00:00:00.000 ).OnChangeWithKeepAliveSubscriptionQossetMaxIntervalMs(long maxIntervalMs)Set the maximum interval in milliseconds.OnChangeWithKeepAliveSubscriptionQossetMinIntervalMs(long minIntervalMs)Set the minimum interval in milliseconds.OnChangeWithKeepAliveSubscriptionQossetPublicationTtlMs(long publicationTtlMs)Set the time-to-live for notification messages.OnChangeWithKeepAliveSubscriptionQossetValidityMs(long validityMs)Set how long the subscription should run for, in milliseconds.-
Methods inherited from class joynr.OnChangeSubscriptionQos
getMinIntervalMs
-
Methods inherited from class joynr.UnicastSubscriptionQos
getPublicationTtlMs
-
Methods inherited from class io.joynr.pubsub.SubscriptionQos
clearExpiryDate, getExpiryDateMs
-
-
-
-
Method Detail
-
getMaxIntervalMs
public long getMaxIntervalMs()
Get the maximum interval in milliseconds.
The provider will send notifications every maximum interval in milliseconds, even if the value didn't change. It will send notifications more often if on-change notifications are enabled, the value changes more often, and the minimum interval QoS does not prevent it. The maximum interval can thus be seen as a sort of heart beat or keep alive interval, if no other publication has been sent within that time.- Returns:
- The maxInterval in milliseconds. The publisher will send a notification at least every maxInterval milliseconds.
-
getPeriodMs
public long getPeriodMs()
Get the maximum interval in milliseconds.
The provider will send notifications every maximum interval in milliseconds, even if the value didn't change. It will send notifications more often if on-change notifications are enabled, the value changes more often, and the minimum interval QoS does not prevent it. The maximum interval can thus be seen as a sort of heart beat or keep alive interval, if no other publication has been sent within that time.- Specified by:
getPeriodMsin interfaceHeartbeatSubscriptionInformation- Returns:
- The maxInterval in milliseconds. The publisher will send a notification at least every maxInterval milliseconds.
-
setMaxIntervalMs
public OnChangeWithKeepAliveSubscriptionQos setMaxIntervalMs(long maxIntervalMs)
Set the maximum interval in milliseconds.
The provider will send publications every maximum interval in milliseconds, even if the value didn't change. It will send notifications more often if on-change notifications are enabled, the value changes more often, and the minimum interval QoS does not prevent it. The maximum interval can thus be seen as a sort of heart beat or keep alive interval, if no other publication has been sent within that time.- Parameters:
maxIntervalMs- The publisher will send a notification at least every maxIntervalMs.
Minimum and Maximum Values- The absolute minimum setting is
50L milliseconds.
Any value less than this minimum will be treated at the absolute minimum setting of50L milliseconds. - The absolute maximum setting is
2592000000L milliseconds.
Any value bigger than this maximum will be treated as the absolute maximum setting of 2592000000L milliseconds.
- The absolute minimum setting is
50L milliseconds.
- Returns:
- this (fluent interface).
-
getAlertAfterIntervalMs
public long getAlertAfterIntervalMs()
Get the alertAfterInterval in milliseconds.
If no notification was received within the last alert interval, a missed publication notification will be raised.- Specified by:
getAlertAfterIntervalMsin interfaceHeartbeatSubscriptionInformation- Returns:
- The alertAfterInterval in milliseconds. If more than alertAfterInterval milliseconds pass without receiving a message, the subscriptionManager will issue a publicationMissed. If set to 0 (NO_ALERT_AFTER_INTERVAL), never alert.
-
setAlertAfterIntervalMs
public OnChangeWithKeepAliveSubscriptionQos setAlertAfterIntervalMs(long alertAfterIntervalMs)
Set the alertAfterInterval in milliseconds.
If no notification was received within the last alert interval, a missed publication notification will be raised.- Parameters:
alertAfterIntervalMs- the max time that can expire without receiving a publication before an alert will be generated. If more than alertIntervalMs pass without receiving a message, subscriptionManager will issue a publicationMissed.- Minimum setting: The value cannot be set below the
value of maxInterval
If a value is passed that is less than this minimum, maxInterval will be used instead. - The absolute maximum setting is 2.592.000.000
milliseconds (30 days).
Any value bigger than this maximum will be treated as the absolute maximum setting of 2.592.000.000 milliseconds.
- Minimum setting: The value cannot be set below the
value of maxInterval
- Returns:
- this (fluent interface).
-
setExpiryDateMs
public OnChangeWithKeepAliveSubscriptionQos setExpiryDateMs(long expiryDateMs)
Description copied from class:SubscriptionQosSet the end date of the subscription, in milliseconds (since 1970-01-01T00:00:00.000 ). The publications will automatically expire at that date.
The provider will send notifications until the expiry date is reached. You will not receive any notifications (neither value notifications nor missed publication notifications) after this date.- Overrides:
setExpiryDateMsin classOnChangeSubscriptionQos- Parameters:
expiryDateMs- is the end date of the subscription.
This value is provided in milliseconds (since 1970-01-01T00:00:00.000). 0L means NO_EXPIRY_DATE.- Returns:
- the subscriptionQos (fluent interface)
-
setMinIntervalMs
public OnChangeWithKeepAliveSubscriptionQos setMinIntervalMs(long minIntervalMs)
Description copied from class:OnChangeSubscriptionQosSet the minimum interval in milliseconds.
Publications will be sent maintaining this minimum interval provided, even if the value changes more often. This prevents the consumer from being flooded by updated values. The filtering happens on the provider's side, thus also preventing excessive network traffic. This value is provided in milliseconds.
Minimum and Maximum Values- Minimum minInterval: 0L. Smaller values will be rounded up.
- Maximum minInterval: 2592000000L. Larger values will be rounded down.
- Overrides:
setMinIntervalMsin classOnChangeSubscriptionQos- Parameters:
minIntervalMs- The publisher will keep a minimum idle time of minIntervalMs between two successive notifications.- Returns:
- this (fluent interface).
-
setPublicationTtlMs
public OnChangeWithKeepAliveSubscriptionQos setPublicationTtlMs(long publicationTtlMs)
Description copied from class:UnicastSubscriptionQosSet the time-to-live for notification messages.
Notification messages will be sent with this time-to-live. If a notification message can not be delivered within its time to live, it will be deleted from the system. This value is provided in milliseconds.- Overrides:
setPublicationTtlMsin classOnChangeSubscriptionQos- Parameters:
publicationTtlMs- publicationTtlMs time-to-live in milliseconds.
Minimum, Maximum and Default Values:- Minimum publicationTtlMs = 100L. Smaller values will be rounded up.
- Maximum publicationTtlMs = 2592000000L. Larger values will be rounded down.
- Default publicationTtlMs = 10000L.
- Returns:
- the subscriptionQos (fluent interface)
-
setValidityMs
public OnChangeWithKeepAliveSubscriptionQos setValidityMs(long validityMs)
Description copied from class:SubscriptionQosSet how long the subscription should run for, in milliseconds. This is a helper method that allows setting the expiryDate using a relative time.- Overrides:
setValidityMsin classOnChangeSubscriptionQos- Parameters:
validityMs- is the number of milliseconds until the subscription will expire- Returns:
- the subscriptionQos (fluent interface)
-
clearAlertAfterInterval
public void clearAlertAfterInterval()
-
hashCode
public int hashCode()
Calculate code for hashing based on member contents and superclass- Overrides:
hashCodein classOnChangeSubscriptionQos- Returns:
- The calculated hash code
-
equals
public boolean equals(Object obj)
Check for equality- Overrides:
equalsin classOnChangeSubscriptionQos- Parameters:
obj- Reference to the object to compare to- Returns:
- true, if objects are equal, false otherwise
-
-