Skip to main content

EnsLib.PubSub.Subscription

persistent class EnsLib.PubSub.Subscription extends %Library.Persistent, %XML.Adaptor

SQL Table Name: EnsLib_PubSub.Subscription

The class holds the list of subscriptions for a Publish / Subscribe table. Topics are strings of the form A.B.C where A, B, or C can be up to 50 characters; Any of A, B, or C, can be "*" which indicates a wild card match.

Property Inventory

Method Inventory

Parameters

parameter SUBTOPICLEN = 50;
Maximum length of subtopics
parameter TOPICINDEX = ^EnsLib.PubSub.SubscriptionI;
Location of topic index
parameter XMLIGNORENULL = 1;
Inherited description: XMLIGNORENULL allows the programmer to override the default XML handling of empty strings for properties of type %String. By default (XMLIGNORENULL = 0), empty strings in the XML input are stored as $c(0) and $c(0) is written to XML as an empty tag. A missing tag in the XML input is always stored as "" and "" is always output to XML as no tag.

If XMLIGNORENULL is set = 1, then both missing tags in the XML and empty strings are input as "", and both "" and $c(0) are output as empty tags (i.e. <tag></tag>).

If XMLIGNORENULL is set = "inputonly", then both missing tags in the XML and empty strings are input as "". Output of "" and $c(0) are for XMLIGNORENULL = 0: $c(0) is output as an empty tag (i.e. <tag></tag>) and "" is output as no tag.

If XMLIGNORENULL = "runtime" (runtime is not case sensitive), then the behavior of XMLIGNORENULL is determined by the format parameter of XMLExport, XMLImport and %XML.Reader.OpenFile. The default behavior for XMLIGNORENULL="runtime is the same as XMLIGNORENULL=0. Adding "ignorenull" to the format argument changes the behavior to that of XMLIGNORENULL=1. "ignorenull" shoud be separated by a comma from literal/encoded part of the format. Example values for format are "", ",ignorenull", "literal,ignorenull" and "encoded,ignorenull". Note that "inputonly" is equivalent to using ,ignorenull for XMLExport and not for %XML.Reader.

Properties

property DomainName as DomainName (XMLNAME = "Domain", XMLPROJECTION = "ATTRIBUTE", XMLREFERENCE = "ID");
Domain value used to keep this subscription list separate from others.
Property methods: DomainNameGet(), DomainNameGetObject(), DomainNameGetObjectId(), DomainNameGetStored(), DomainNameGetSwizzled(), DomainNameIsValid(), DomainNameNewObject(), DomainNameSet(), DomainNameSetObject(), DomainNameSetObjectId(), DomainNameUnSwizzle()
property OldValues as %String (MAXLEN = 1000, XMLPROJECTION = "NONE") [ MultiDimensional , Transient ];
Used to remember old values when modifying a subscription.
Property methods: OldValuesDisplayToLogical(), OldValuesGet(), OldValuesIsValid(), OldValuesLogicalToDisplay(), OldValuesLogicalToOdbc(), OldValuesNormalize(), OldValuesSet()
relationship Subscriber as Subscriber (XMLPROJECTION = "NONE") [ Required , Inverse = Subscriptions , Cardinality = one ];
Subscriber
Property methods: SubscriberGet(), SubscriberGetObject(), SubscriberGetObjectId(), SubscriberGetStored(), SubscriberGetSwizzled(), SubscriberIsValid(), SubscriberNewObject(), SubscriberOnDelete(), SubscriberRClose(), SubscriberRExec(), SubscriberRFetch(), SubscriberRelate(), SubscriberSQLCompute(), SubscriberSet(), SubscriberSetObject(), SubscriberSetObjectId(), SubscriberUnRelate(), SubscriberUnSwizzle()
property SubscriberName as %String (XMLNAME = "Subscriber", XMLPROJECTION = "ATTRIBUTE") [ Transient ];
Link to subscriber name (used for Export).
Property methods: SubscriberNameDisplayToLogical(), SubscriberNameIsValid(), SubscriberNameLogicalToDisplay(), SubscriberNameLogicalToOdbc(), SubscriberNameNormalize()
property Topic as %String (MAXLEN = 1000, XMLPROJECTION = "ATTRIBUTE") [ Required ];
Topic that this subscription is based upon.
This is a string containing a series of subtopics of the form A.B.C.; Any subtopic may be "*" for a wild card match.
Property methods: TopicDisplayToLogical(), TopicGet(), TopicGetStored(), TopicIsValid(), TopicLogicalToDisplay(), TopicLogicalToOdbc(), TopicNormalize(), TopicSet()

Methods

classmethod ClearIndexEntry(pDomainName As %String, pTopic As %String, pSubscriber As %String, pID As %String)
Clear out an entry in the special index
classmethod FindSubscribers(pDomain As %String, pTopic As %String, Output pSubscribers As %String) as %Status
Find a list of subscribers for a given topic string.
Look directly into index for the answer
Returns an array of subscriber ID numbers with nodes containing number of matches.
classmethod PurgeSpecialIndex(pDomain As %String = "")
Purge the special index used by the subscription table.
method SubscriberNameGet() as %String
Override of property accessor
method SubscriberNameSet(%val As %String) as %Status
Override of property accessor

Queries

query Enumerate()
SQL Query:
SELECT %ID,DomainName,Topic,Subscriber->Name As Subscriber FROM Subscription ORDER BY DomainName,Topic
Provide a list of subscriptions.

Indexes

index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()

Triggers

trigger SQLDeleteTrigger (BEFORE event DELETE);
Clean up special subscription index

Inherited Members

Inherited Methods

Storage

Storage Model: Storage (EnsLib.PubSub.Subscription)

^EnsLib.PubSub.SubscriptionD(ID)
=
%%CLASSNAME
DomainName
SubTopic1
SubTopic2
SubTopic3
Subscriber
Topic
FeedbackOpens in a new tab