@Beta public final class UnparsedNotification extends Notification
Beta Thread-safe implementation.
Example usage:
void handleNotification(Subscription subscription, UnparsedNotification notification)
throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(notification.getContent()));
System.out.println(reader.readLine());
reader.close();
}
| Constructor and Description |
|---|
UnparsedNotification(String subscriptionId,
String topicId,
String topicURI,
String clientToken,
long messageNumber,
String eventType,
String changeType,
String contentType,
InputStream unparsedStream)
Creates a
Notification whose content has not yet been read and parsed. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
deliverNotification(SubscriptionStore subscriptionStore)
Handles a newly received notification, and delegates it to the registered handler.
|
InputStream |
getContent()
Returns the content stream of this notification.
|
String |
getContentType()
Returns the Content-Type of the Content of this notification.
|
getChangeType, getClientToken, getEventType, getMessageNumber, getSubscriptionId, getTopicId, getTopicURIpublic UnparsedNotification(String subscriptionId, String topicId, String topicURI, String clientToken, long messageNumber, String eventType, String changeType, String contentType, InputStream unparsedStream)
Notification whose content has not yet been read and parsed.subscriptionId - subscription UUIDtopicId - opaque ID for the subscribed resource that is stable across API versionstopicURI - opaque ID (in the form of a canonicalized URI) for the subscribed resource that
is sensitive to the API versionclientToken - client token (an opaque string) or null for nonemessageNumber - message number (a monotonically increasing value starting with 1)eventType - event type (see EventTypes)changeType - type of change performed on the resource or null for noneunparsedStream - Unparsed content in form of a InputStream. Caller has the
responsibility of closing the stream.public final String getContentType()
public final InputStream getContent()
public boolean deliverNotification(SubscriptionStore subscriptionStore) throws IOException
subscriptionStore - subscription storetrue if the notification was delivered successfully, or false if this
notification could not be delivered and the subscription should be cancelled.IllegalArgumentException - if there is a client-token mismatchIOExceptionCopyright © 2010-2013 Google. All Rights Reserved.