Skip to content

TBoldPublisher

Unit: BoldSubscription

Declaration

TBoldPublisher = class(TBoldMemoryManagedObject)

Hierarchy

  1. TObject
  2. TBoldMemoryManagedObject
  3. TBoldPublisher

Description

Developers will not use a TBoldPublisher directly except when Making_a_Class_Subscribable_Task. In most normal use, the methods on TBoldSubscribableObject will be used.

TBoldPublisher performs the publishing part of the Subscription_Mechanism.

Properties

Name Summary Notes
HasSubscribers HasSubscribers is true if the publisher has any subscribers. read-only

HasSubscribers

property HasSubscribers: Boolean;

HasSubscribers is true if the publisher has any subscribers.

Methods

Name Summary Notes
AddSmallSubscription
AddSubscription
Create
Destroy Destructor for TBoldPublisher. override
EndNotify
GetPublisherFlag protected
NotifySubscribersAndClearSubscriptions The method will perform a SendEvent (Originator, beDestroying), and subsequently clear all subscriptions.
SendExtendedEvent A call to this method will lead to TBoldSubscriber_Receive beeing called for all subscribers holding a subscription mathching OriginalEvent.
SendQuery
SetPublisherFlag protected
StartNotify

AddSmallSubscription

procedure AddSmallSubscription(Subscriber: TBoldSubscriber; Events: TBoldSmallEventSet; RequestedEvent: TBoldRequestedEvent);
Note
If Subscriber already has a subscription with the same RequestedEvent, Events will be merged into that subscription. A consequence of this is that subscribing to the same event multiple times with the same RequestedEvent will only give one subscription.
Parameters
Subscriber The subscriber to be notified if TBoldPublisher_SendEvent or TBoldPublisher_SendQuery is called with an event matching Event.
Events The set of events to match
RequestedEvent The value send as the RequestedEvent parameter to TBoldSubscriber_Receive or TBoldSubscriber_Answer.

AddSubscription

procedure AddSubscription(Subscriber: TBoldSubscriber; OriginalEvent: TBoldEvent; RequestedEvent: TBoldRequestedEvent);
Note
If Subscriber already has a subscription with the same RequestedEventand and the same OriginalEvent, no additional subsctiption is placed.
Parameters
Subscriber The subscriber to be notified if SendEvent or SendQuery is called with an event matching Event.
OriginalEvent The set of events to match
RequestedEvent The value send as the RequestedEvent parameter to Receive or Answer.

Create

constructor Create;

Destroy

destructor Destroy; override;

Will raise an exception if the publicher still has subscribers. Subscribers should be cleared prior to destruction by calling NotifySubscribersAndClearSubscriptions.

EndNotify

class procedure EndNotify;

GetPublisherFlag

function GetPublisherFlag(Flag: TBoldPublisherFlag): Boolean;

NotifySubscribersAndClearSubscriptions

procedure NotifySubscribersAndClearSubscriptions(Originator: TObject);

In general this method will be called by the object using the publisher early in the destructor, in order to prepare all subscribers for the destruction, and ensure that no spurious events are generated during the destruction process.

Parameters
Originator The objects to be sent as the Originator to SendEvent. In general the object using the publisher to become subscribable

SendExtendedEvent

procedure SendExtendedEvent(Originator: TObject; OriginalEvent: TBoldEvent; const Args: array of const); | Parameters | |---| | Originator | The objects to be sent as the Originator parameter to Receive. | |---|---| | OriginalEvent | The value used as the OriginalEvent parameter to Receive. |

A call to this method will lead to TBoldSubscriber_Receive beeing called for all subscribers holding a subscription mathching OriginalEvent.

SendQuery

function SendQuery(Originator: TObject; OriginalEvent: TBoldEvent; const Args: array of const; Subscriber: TBoldSubscriber): Boolean;

SetPublisherFlag

procedure SetPublisherFlag(Flag: TBoldPublisherFlag; Value: Boolean);

StartNotify

class procedure StartNotify;

Generated from the Bold 4.0 help (Help/BfD.chm) by Tools/chm2mkdocs.py; member lists reflect Bold 4.0, see the source for members added since.