subscription manager - Openwsman/openwsman GitHub Wiki

Subscription Manager

Workflow

When a subscription request is received, if it is a valid request, it will be saved in the subscription repository and in the memory at the same time and a response message will be returned with expiration time(if any) and corresponding subscription identifier. If it is not, an error message will be returned with causes.

Renew request message should include subscripton identifier which is returned by the subscription manager when subscription is made.

Unsubscribe request should include subscription identifier which is returned by the subscription manager when subscription is made.

Subscription Repository

Why is Subscription Repository needed?

There are mainly two reasons:

  • In many occasions, WS-Management working environment is distributed. When the Subscription Manager receives a subscribe request, it has to save this subscription to a Subscription Repository in another physical location, which can also be accessed by the Notification Manager.
  • If there is a subscription repository, the service will recover after restarting without loss of subscribed data.

Goal of implementation

Although we have to decide one kind of repository in our implementation, the implementation should be designed extensible. That is, it should be changed easily if another kind of repository is considered.

Related Data structures

To achieve this goal, callback functions are used. Fuction table of Subscription Repository operations will be registered in the __Soap object when the service finishes loading all plug-ins. The function table should include operations “load all subscriptions”, “get/update/save/delete a specific subscription”. Once the function table is registered, it can be used in the runtime late. If you want to implement a different repository, just change related subscriptions functions.

Related data structures are shown below:

typedef int (*SubscriptionOpInit) (char *, void *); typedef int (*SubscriptionOpFinalize) (char *, void *); typedef int (*SubscriptionOpSave) (char *, char *, char *); typedef int (*SubscriptionOpDelete) (char *, char *); typedef int (*SubscriptionOpGet)(char *, char *, char *); typedef int (*SubscriptionOpSearch) (char *, char *); typedef int (*SubscriptionOpUpdate)(char *, char *, char *); typedef int (*SubscriptionOpLoad) (char *, list_t *); struct __SubsRepositoryEntry { char *strdoc; char *uuid; }; typedef struct __SubsRepositoryEntry *SubsRepositoryEntryH; struct __SubsRepositoryOpSet{ SubscriptionOpLoad load_subscription; SubscriptionOpGet get_subscription; SubscriptionOpSave save_subscritption; SubscriptionOpUpdate update_subscription; SubscriptionOpDelete delete_subscription; };

And we also need to add two fields in the __Soap structure:

char *uri_subsRepository;//URI of repository SubsRepositoryOpSetH subscriptionOpSet; //Function talbe of Subscription Repository

Implementation of Local Subscription Repository

If you want another repository, just change related subscription operations. In this implementation a subscription is saved in a file with the name of UUID returned by the Notification Manager.

Definitions of local Subscription Repository operations:

int LocalSubscriptionOpInit (char * uri_repository, void *opaqueData); int LocalSubscriptionOpFinalize(char * uri_repository, void *opaqueData); int LocalSubscriptionOpGet(char * uri_repository, char * uuid, char **subscriptionDoc); int LocalSubscriptionOpSearch(char * uri_repository, char * uuid); int LocalSubscriptionOpLoad (char * uri_repository, list_t * subscription_list); int LocalSubscriptionOpSave (char * uri_repository, char * uuid, char *subscriptionDoc); int LocalSubscriptionOpUpdate(char * uri_repository, char * uuid, char *expire); int LocalSubscriptionOpDelete (char * uri_repository, char * uuid); Function tabre of local Subscription Repository operations:

struct __SubsRepositoryOpSet subscription_repository_op_set # {LocalSubscriptionOpInit, LocalSubscriptionOpFinalize, LocalSubscriptionOpLoad, LocalSubscriptionOpGet, LocalSubscriptionOpSearch, LocalSubscriptionOpSave, LocalSubscriptionOpUpdate, LocalSubscriptionOpDelete};

⚠️ **GitHub.com Fallback** ⚠️