@Beta public final class StoredChannel extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DATA_STORE_ID
Default data store ID.
|
Constructor and Description |
---|
StoredChannel(UnparsedNotificationCallback notificationCallback)
Constructor with a random UUID using
NotificationUtils.randomUuidString() . |
StoredChannel(UnparsedNotificationCallback notificationCallback,
String id)
Constructor with a custom UUID.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
getClientToken()
Returns the arbitrary string provided by the client associated with this subscription that is
delivered to the target address with each notification or
null for none. |
static DataStore<StoredChannel> |
getDefaultDataStore(DataStoreFactory dataStoreFactory)
Returns the stored channel data store using the ID
DEFAULT_DATA_STORE_ID . |
Long |
getExpiration()
Returns the milliseconds in Unix time at which the subscription will expire or
null for
an infinite TTL. |
String |
getId()
Returns the subscription UUID.
|
UnparsedNotificationCallback |
getNotificationCallback()
Returns the notification callback called when a notification is received for this subscription.
|
String |
getTopicId()
Returns the opaque ID for the subscribed resource that is stable across API versions or
null for none. |
int |
hashCode() |
StoredChannel |
setClientToken(String clientToken)
Sets the the arbitrary string provided by the client associated with this subscription that is
delivered to the target address with each notification or
null for none. |
StoredChannel |
setExpiration(Long expiration)
Sets the milliseconds in Unix time at which the subscription will expire or
null for an
infinite TTL. |
StoredChannel |
setTopicId(String topicId)
Sets the opaque ID for the subscribed resource that is stable across API versions or
null for none. |
StoredChannel |
store(DataStore<StoredChannel> dataStore)
Stores this notification channel in the given notification channel data store.
|
StoredChannel |
store(DataStoreFactory dataStoreFactory)
Stores this notification channel in the notification channel data store, which is derived from
getDefaultDataStore(DataStoreFactory) on the given data store factory. |
String |
toString() |
public static final String DEFAULT_DATA_STORE_ID
public StoredChannel(UnparsedNotificationCallback notificationCallback)
NotificationUtils.randomUuidString()
.notificationCallback
- notification handler called when a notification is received for
this subscriptionpublic StoredChannel(UnparsedNotificationCallback notificationCallback, String id)
notificationCallback
- notification handler called when a notification is received for
this subscriptionid
- subscription UUIDpublic StoredChannel store(DataStoreFactory dataStoreFactory) throws IOException
getDefaultDataStore(DataStoreFactory)
on the given data store factory.
It is important that this method be called before the watch HTTP request is made in case the notification is received before the watch HTTP response is received.
dataStoreFactory
- data store factoryIOException
public StoredChannel store(DataStore<StoredChannel> dataStore) throws IOException
It is important that this method be called before the watch HTTP request is made in case the notification is received before the watch HTTP response is received.
dataStore
- notification channel data storeIOException
public UnparsedNotificationCallback getNotificationCallback()
public String getClientToken()
null
for none.public StoredChannel setClientToken(String clientToken)
null
for none.public Long getExpiration()
null
for
an infinite TTL.public StoredChannel setExpiration(Long expiration)
null
for an
infinite TTL.public String getId()
public String getTopicId()
null
for none.public StoredChannel setTopicId(String topicId)
null
for none.public static DataStore<StoredChannel> getDefaultDataStore(DataStoreFactory dataStoreFactory) throws IOException
DEFAULT_DATA_STORE_ID
.dataStoreFactory
- data store factoryIOException
Copyright © 2010–2022 Google. All rights reserved.