org.ws4d.java.eventing
Interface ClientSubscription

All Known Subinterfaces:
ClientSubscriptionInternal

public interface ClientSubscription

Subscription interface, allows client-side management of a subscription, such as renewing, unsubscribing, obtaining the current status, etc.


Method Summary
 java.lang.String getCommunicationManagerId()
          returns the ID of the communication manager used to communicate with the subscription manager corresponding to this client subscription instance (see #getServiceSubscriptionReference())
 EventSink getEventSink()
          Returns the event sink, which receives subscribed messages.
 ServiceReference getServiceReference()
          Returns a reference to the subscribed service.
 java.lang.String getServiceSubscriptionId()
          Returns the server-side subscription identifier for this subscription (in terms of WS-Eventing, this is the wse:Identifier URI).
 long getStatus()
          Get the duration until expiration of this subscription.
 EprInfo getSubscriptionManagerAddressInfo()
          Returns the EprInfo of the server-side subscription manager for this subscription.
 long getTimeoutTime()
          Get system time in millis from the epoch when subscription will terminate.
 long renew(long duration)
          Renews subscription.
 void unsubscribe()
          Terminates this subscription.
 

Method Detail

getTimeoutTime

long getTimeoutTime()
Get system time in millis from the epoch when subscription will terminate. If "0", subscription will never terminate.

Returns:
the time in terms of millis from the epoch when this subscription will expire

getSubscriptionManagerAddressInfo

EprInfo getSubscriptionManagerAddressInfo()
Returns the EprInfo of the server-side subscription manager for this subscription.

Be aware that the xAddress of the returned EprInfo may be null if the endpoint reference is not a transport address

Returns:
the EprInfo of this subscription's subscription manager

getCommunicationManagerId

java.lang.String getCommunicationManagerId()
returns the ID of the communication manager used to communicate with the subscription manager corresponding to this client subscription instance (see #getServiceSubscriptionReference())

Returns:
the communication manager ID of this client subscription's subscription manager

getServiceSubscriptionId

java.lang.String getServiceSubscriptionId()
Returns the server-side subscription identifier for this subscription (in terms of WS-Eventing, this is the wse:Identifier URI).

Returns:
the server-side subscription ID

getEventSink

EventSink getEventSink()
Returns the event sink, which receives subscribed messages.

Returns:
the event sink behind this subscription

getServiceReference

ServiceReference getServiceReference()
Returns a reference to the subscribed service.

Returns:
a reference to the service this subscription refers to

renew

long renew(long duration)
           throws EventingException,
                  TimeoutException
Renews subscription.

Parameters:
duration - new duration of subscription
Returns:
the new expiration duration or 0 in case the subscription doesn't expire at all
Throws:
EventingException - in case this subscription has already expired or an invalid duration was specified
TimeoutException - if this subscription refers to a remote service and contacting it timed out

unsubscribe

void unsubscribe()
                 throws EventingException,
                        TimeoutException
Terminates this subscription. If terminated renew or status requests can't be fulfilled.

Throws:
EventingException - if the subscription has already expired
TimeoutException - if this subscription refers to a remote service and contacting it timed out

getStatus

long getStatus()
               throws EventingException,
                      TimeoutException
Get the duration until expiration of this subscription. The special return value of 0 means the subscription never expires.

Returns:
the duration until expiration in milliseconds
Throws:
TimeoutException - if this subscription refers to a remote service and contacting it timed out
EventingException - if the subscription already expired