Package com.opencloud.sip.biggroup
Interface SubscriptionActivity
-
public interface SubscriptionActivity
Represents the group of dialogs that are subscribed to a resource. Used by a notifier application to efficiently notify large groups of subscribers (Big Notify).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.
Activity Creation
TheSubscriptionActivity
for a resource is created on demand by callingBigGroupProvider.getSubscriptionActivity(String, boolean)
. This method takes an application-defined string key, which uniquely identifies the subscribed resource.Activity Ending
The activity is explicitly ended whenterminate()
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.Initial Subscription Requests
When an initial (out of dialog) SUBSCRIBE request arrives, the request event will be fired on theServerTransaction
activity, as normal. It is the application's responsibility to create the dialog activity for the subscription. The application may then calladdSubscriptionDialog()
to add the dialog to the set of subscription dialogs associated with theSubscriptionActivity
. The dialog will then take part in any Big Notify operations. The application should set a timer based on the subscription's expiry time.Subscription Refresh Requests
Subscription refresh requests (re-SUBSCRIBEs on the subscription dialog) will be fired as normal on their respective dialog activities, as mid-dialog request events. TheSubscriptionActivity
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 theSubscriptionActivity
usingremoveSubscriptionDialog(net.java.slee.resource.sip.DialogActivity)
.Big Notify
ThesendNotify()
method initiates a Big Notify operation. This is where a NOTIFY is sent on all dialogs associated with aSubscriptionActivity
. This is more efficient and convenient than the application generating all the NOTIFY requests itself. This creates aNotifyActivity
, and the results of the notification are collected in aNotifyResultEvent
.Subscription Expiry
It is up to the application to determine whether a subscription has expired. When the application determines that a subscription has expired, it should remove that dialog from theSubscriptionActivity
usingremoveSubscriptionDialog(net.java.slee.resource.sip.DialogActivity)
. This will ensure the dialog no longer takes part in Big Notify operations.Removing subscription dialogs
The application can explicitly disassociate a subscription dialog from aSubscriptionActivity
by callingremoveSubscriptionDialog(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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addSubscriptionDialog(net.java.slee.resource.sip.DialogActivity dialog)
Adds the given dialog to thisSubscriptionActivity
.String
getResourceName()
Get the unique string that identifies the subscribed resource.void
removeSubscriptionDialog(net.java.slee.resource.sip.DialogActivity subscriberDialog)
Removes the given dialog from thisSubscriptionActivity
.NotifyActivity
sendNotify(long timeout, UpdateRequest notifyUpdater)
Generates and sends a NOTIFY out on all subscription dialogs, and gathers the responses in a singleNotifyResultEvent
, a.k.a.void
terminate()
Terminates this subscription activity immediately.
-
-
-
Method Detail
-
getResourceName
String getResourceName()
Get the unique string that identifies the subscribed resource. This was set when the activity was created byBigGroupProvider.getSubscriptionActivity(String, boolean)
.- Returns:
- a string uniquely identifying the subscribed resource.
-
addSubscriptionDialog
void addSubscriptionDialog(net.java.slee.resource.sip.DialogActivity dialog)
Adds the given dialog to thisSubscriptionActivity
. The dialog will now take part in subsequent Big Notify operations on this activity.- Parameters:
dialog
- a dialog activity that was created by an initial SUBSCRIBE request.
-
removeSubscriptionDialog
void removeSubscriptionDialog(net.java.slee.resource.sip.DialogActivity subscriberDialog)
Removes the given dialog from thisSubscriptionActivity
. 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 thisSubscriptionActivity
, it will be ended automatically.- Parameters:
subscriberDialog
- the subscription dialog representing a subscribed user agent
-
sendNotify
NotifyActivity sendNotify(long timeout, UpdateRequest notifyUpdater)
Generates and sends a NOTIFY out on all subscription dialogs, and gathers the responses in a singleNotifyResultEvent
, a.k.a. Big Notify.- Parameters:
timeout
- the maximum time (in milliseconds) to wait for all responses, before firing theNotifyResultEvent
.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.- Returns:
- a new
NotifyActivity
, on which theNotifyResultEvent
will be fired - Throws:
IllegalArgumentException
- if timeout is negative or notifyUpdater isnull
-
terminate
void terminate()
Terminates this subscription activity immediately. No messages are sent on the subscription dialogs.
-
-