public final class StreamingSubscriptionConnection extends Object implements Closeable, HangingServiceRequestBase.IHandleResponseObject, HangingServiceRequestBase.IHangingRequestDisconnectHandler
Modifier and Type | Class and Description |
---|---|
static interface |
StreamingSubscriptionConnection.INotificationEventDelegate |
static interface |
StreamingSubscriptionConnection.ISubscriptionErrorDelegate |
Constructor and Description |
---|
StreamingSubscriptionConnection(ExchangeService service,
int lifetime)
Initializes a new instance of the StreamingSubscriptionConnection class.
|
StreamingSubscriptionConnection(ExchangeService service,
Iterable<StreamingSubscription> subscriptions,
int lifetime)
Initializes a new instance of the StreamingSubscriptionConnection class.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
Set event to happen when property disconnect.
|
void |
addOnNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
Set event to happen when property Notify.
|
void |
addOnSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
Set event to happen when property subscriptionError.
|
void |
addSubscription(StreamingSubscription subscription)
Adds a subscription to this connection.
|
void |
clearDisconnect()
Clears disconnect events list.
|
void |
clearNotificationEvent()
Clears notification events list.
|
void |
clearSubscriptionError()
Clears subscription events list.
|
void |
close()
Closes this connection so it stops receiving events from the server.This
terminates a long-standing call to EWS.
|
void |
dispose()
Frees resources associated with this StreamingSubscriptionConnection.
|
boolean |
getIsOpen()
Gets a value indicating whether this connection is opened
|
void |
handleResponseObject(Object response)
Callback delegate to handle asynchronous response.
|
void |
hangingRequestDisconnectHandler(Object sender,
HangingRequestDisconnectEventArgs args)
Delegate method to handle a hanging request disconnection.
|
void |
open()
Opens this connection so it starts receiving events from the server.This
results in a long-standing call to EWS.
|
void |
removeDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
Remove the event from happening when property disconnect.
|
void |
removeNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
Remove the event from happening when property Notify.
|
void |
removeSubscription(StreamingSubscription subscription)
Removes the specified streaming subscription from the connection.
|
void |
removeSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
Remove the event from happening when property subscription.
|
public StreamingSubscriptionConnection(ExchangeService service, int lifetime) throws Exception
service
- The ExchangeService instance this connection uses to connect
to the server.lifetime
- The maximum time, in minutes, the connection will remain open.
Lifetime must be between 1 and 30.Exception
public StreamingSubscriptionConnection(ExchangeService service, Iterable<StreamingSubscription> subscriptions, int lifetime) throws Exception
service
- The ExchangeService instance this connection uses to connect
to the server.subscriptions
- Iterable subcriptionslifetime
- The maximum time, in minutes, the connection will remain open.
Lifetime must be between 1 and 30.Exception
public void addOnNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
notificationEvent
- notification eventpublic void removeNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
notificationEvent
- notification eventpublic void clearNotificationEvent()
public void addOnSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
subscriptionError
- subscription eventpublic void removeSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
subscriptionError
- subscription eventpublic void clearSubscriptionError()
public void addOnDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
disconnect
- disconnect eventpublic void removeDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
disconnect
- disconnect eventpublic void clearDisconnect()
public void addSubscription(StreamingSubscription subscription) throws Exception
subscription
- The subscription to add.Exception
- Thrown when AddSubscription is called while connected.public void removeSubscription(StreamingSubscription subscription) throws Exception
subscription
- The subscription to remove.Exception
- Thrown when RemoveSubscription is called while connected.public void open() throws ServiceLocalException, Exception
Exception
ServiceLocalException
- Thrown when Open is called while connected.public void close()
close
in interface Closeable
close
in interface AutoCloseable
public boolean getIsOpen() throws Exception
Exception
public void dispose()
public void handleResponseObject(Object response) throws ArgumentException
HangingServiceRequestBase.IHandleResponseObject
handleResponseObject
in interface HangingServiceRequestBase.IHandleResponseObject
response
- Response received from the serverArgumentException
public void hangingRequestDisconnectHandler(Object sender, HangingRequestDisconnectEventArgs args)
HangingServiceRequestBase.IHangingRequestDisconnectHandler
hangingRequestDisconnectHandler
in interface HangingServiceRequestBase.IHangingRequestDisconnectHandler
sender
- the object invoking the delegateargs
- event dataCopyright © 2012–2015 Microsoft. All rights reserved.