public interface SubscriptionActivity
NB: Dialogs may be associated with any number of subscription activities. Apart from the Big Notify operation, it is the application's responsibility to send the appropriate messages on each dialog during subscription initiation, refreshes and termination. For example, the application must respond to the initial SUBSCRIBE request and send the initial NOTIFY request on a new dialog, and it must send the final "Subscription-State: terminated" NOTIFY request on the dialog.
SubscriptionActivity
for a resource is created on demand by calling
BigGroupProvider.getSubscriptionActivity(String, boolean)
. This method
takes an application-defined string key, which uniquely identifies the subscribed resource.
terminate()
is called, or
may be ended implicitly when all subscription dialog activities have ended, and no SLEE
facilities (timer, AC naming etc) have references to the activity.
ServerTransaction
activity, as normal. It is the application's responsibility to
create the dialog activity for the subscription. The application may then call
addSubscriptionDialog()
to add the dialog to the set of subscription dialogs associated with the
SubscriptionActivity
. The dialog will then take part in any Big Notify
operations. The application should set a timer based on the subscription's expiry time.
SubscriptionActivity
does not directly take part in subscription refreshes, it is up to the application to process them.
If the refresh is accepted, the application should reset the subscription's expiry timer, if it set one.
If the application does not accept the refresh, it can end the dialog, or remove it from the SubscriptionActivity
using removeSubscriptionDialog(net.java.slee.resource.sip.DialogActivity)
.
sendNotify()
method initiates a Big Notify operation. This is where
a NOTIFY is sent on all dialogs associated with a SubscriptionActivity
. This is more efficient
and convenient than the application generating all the NOTIFY requests itself. This creates a
NotifyActivity
, and the results of the notification are collected in a NotifyResultEvent
.
SubscriptionActivity
using removeSubscriptionDialog(net.java.slee.resource.sip.DialogActivity)
. This will ensure the
dialog no longer takes part in Big Notify operations.
SubscriptionActivity
by calling removeSubscriptionDialog(net.java.slee.resource.sip.DialogActivity)
. This does not happen
automatically when the dialog activity ends for any reason. When a subscription dialog is removed it no
longer takes part in Big Notify operations.Modifier and Type | Method and Description |
---|---|
void |
addSubscriptionDialog(DialogActivity dialog)
Adds the given dialog to this
SubscriptionActivity . |
String |
getResourceName()
Get the unique string that identifies the subscribed resource.
|
void |
removeSubscriptionDialog(DialogActivity subscriberDialog)
Removes the given dialog from this
SubscriptionActivity . |
NotifyActivity |
sendNotify(long timeout,
UpdateRequest notifyUpdater)
Generates and sends a NOTIFY out on all subscription dialogs, and gathers the responses in a single
NotifyResultEvent , a.k.a. |
void |
terminate()
Terminates this subscription activity immediately.
|
String getResourceName()
BigGroupProvider.getSubscriptionActivity(String, boolean)
.void addSubscriptionDialog(DialogActivity dialog)
SubscriptionActivity
. The dialog will now take part in
subsequent Big Notify operations on this activity.dialog
- a dialog activity that was created by an initial SUBSCRIBE request.void removeSubscriptionDialog(DialogActivity subscriberDialog)
SubscriptionActivity
. The dialog will no longer take
part in subsequent Big Notify operations on this activity.
No messages are sent on the dialog. If there are no more subscribed dialogs, and no SLEE facilities
have references to this SubscriptionActivity
, it will be ended automatically.subscriberDialog
- the subscription dialog representing a subscribed user agentNotifyActivity sendNotify(long timeout, UpdateRequest notifyUpdater)
NotifyResultEvent
, a.k.a. Big Notify.timeout
- the maximum time (in milliseconds) to wait for all responses, before firing the
NotifyResultEvent
.notifyUpdater
- a function to update the NOTIFY request before it is sent. This must be used
to populate the NOTIFY request with the application's current view of resource state.NotifyActivity
, on which the NotifyResultEvent
will be firedIllegalArgumentException
- if timeout is negative or notifyUpdater is null
void terminate()