TRODBEventRepository
Overview
The TRODBEventRepository class is inherited from the base event repository class and designed to allow the usage of almost any database as events storage. For this, the component requires a number of data access components (TDataSet descendants) to be created and a proper database structure (see below). Those data access components are responsible for the actual communication with the DBMS and database. Datasets execution and passing parameters to them can be flexibly customized with help of the OnDataset* event handlers.
Use this event repository if it is necessary to create a persistent and/or shared events repository and Olympia Server with the corresponding TROOlympiaEventRepository can't be used for some reason.
DB script
CREATE TABLE [Messages](
[MessageInc] [int] IDENTITY(1,1) NOT NULL,
[Created] [datetime] NULL,
[SourceSessionID] [char](38) NOT NULL,
[Data] [image] NULL,
CONSTRAINT [PK_Messages] PRIMARY KEY
([MessageInc] ASC)
)
GO
CREATE INDEX [Messages_IDX1] ON [Messages] ([Created] ASC)
GO
CREATE TABLE [MessagesPerSession](
[SessionID] [char](38) NOT NULL,
[MessageInc] [int] NOT NULL,
CONSTRAINT [PK_MessagesPerSession] PRIMARY KEY
( [SessionID] ASC, [MessageInc] ASC)
)
GO
CREATE INDEX [MessagesPerSession_IDX1] ON [MessagesPerSession] ([MessageInc] ASC)
GO
CREATE TABLE [dbo].[SessionsEvents] (
[SessionID] [char] (38) NOT NULL,
[Created] [datetime] NOT NULL,
[LastAccessed] [datetime] NOT NULL,
[Data] [image] NULL
)
GO
CREATE TABLE [EventsSubscriptions] (
[SessionID] char(38) NOT NULL,
[EventSinkID] varchar(255) NOT NULL,
PRIMARY KEY CLUSTERED ([SessionID], [EventSinkID])
)
GO
Required Datasets/Commands:
Name | SQL |
---|---|
AddSessionsEventsDataset | INSERT INTO SessionsEvents ([SessionID], [Created], [LastAccessed], [Data]) VALUES (:SessionID, :Created, :LastAccessed, :Data) |
AddSubscriptionDataset | INSERT INTO EventsSubscriptions (SessionID, EventSinkID) VALUES (:SessionID, :EventSinkID) |
CheckSubscriptionDataset | SELECT COUNT(*) FROM EventsSubscriptions WHERE ((EventSinkID = :EventSinkID) OR (EventSinkID = '*')) AND SessionID = :SessionID |
ClearSessionsEventsDataset | DELETE FROM SessionsEvents |
ClearSubscriptionsDataset | DELETE FROM EventsSubscriptions |
DeleteMessages | DELETE FROM Messages WHERE MessageInc = :MessageInc |
DeleteMessagesPerSession | DELETE FROM MessagesPerSession WHERE SessionID = :SessionID AND MessageInc = :MessageInc |
DeleteOldMessages | DELETE FROM Messages WHERE Created < :Created |
DeleteOldMessagesPerSession | DELETE FROM MessagesPerSession WHERE MessageInc IN (SELECT MessageInc FROM Messages WHERE Created < :Created) |
DeleteSessionsEventsDataset | DELETE FROM SessionsEvents WHERE SessionID = :SessionID |
DeleteSubscriptionDataset | DELETE FROM EventsSubscriptions WHERE (SessionID = :SessionID) AND (EventSinkID = :EventSinkID) |
DeleteSubscriptionPerSessionDataset | DELETE FROM EventsSubscriptions WHERE SessionID = :SessionID |
DeleteUnusedMessages | DELETE FROM Messages WHERE MessageInc NOT IN (SELECT DISTINCT MessageInc FROM MessagesPerSession) |
GetAllSessionsEventsDataset | SELECT * FROM SessionsEvents |
GetMessageInc | SELECT ISNULL(Ident_Current('Messages'), 0) AS LastInc |
GetMessages | SELECT m.MessageInc, m.Data FROM MessagesPerSession mps JOIN Messages m ON (m.MessageInc = mps.MessageInc) WHERE mps.SessionID = :SessionID |
GetSessionsEventsDataset | SELECT * FROM SessionsEvents WHERE SessionID = :SessionID |
InsertMessages | INSERT INTO Messages (Created, SourceSessionID, Data) VALUES (:Created, :SourceSessionID, :Data) |
InsertMessagesPerSession | INSERT INTO MessagesPerSession (SessionID, MessageInc) VALUES (:SessionID, :MessageInc) |
Location
- Unit: uRODBEventRepository.pas
- Ancestry: TComponent | TROComponent | TROEventRepository | TRODBEventRepository
constructor Create override
Standard component constructor
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
AddActiveListener deprecated (declared in TROEventRepository)
Registers aSessionID
as an event sink with an aActiveEventServer
instance of the IROActiveEventServer as an event dispatcher.
function AddActiveListener(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer): Boolean
Parameters:
- aSessionID: Unique session GUID
- aActiveEventServer: Custom event dispatcher
AddSession (TGUID) overload (declared in TROEventRepository)
Performs registration of a given session.
procedure AddSession(aSessionID: TGUID)
Parameters:
- aSessionID: Session ID
AddSession (TGUID, IROActiveEventServer) overload (declared in TROEventRepository)
Performs registration of a given session and event dispatcher.
procedure AddSession(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer)
Parameters:
- aSessionID: Unique session GUID
- aActiveEventServer: Custom event dispatcher
AddSession (TGUID, IROActiveEventServer, string) overload (declared in TROEventRepository)
Performs registration of a given session and event dispatcher.
procedure AddSession(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer; aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aActiveEventServer: Custom event dispatcher
- aEventSinkId: Event sink
AddSession (TGUID, string) overload (declared in TROEventRepository)
Performs registration of a given session.
procedure AddSession(aSessionID: TGUID; aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
AddSessionsEventsDataset
Points to the dataset containing the SQL statement to add a session to the repository.
property AddSessionsEventsDataset: TDataset read write
AddSubscriptionDataset
Points to the dataset containing the SQL statement to subscribe the session to events of a certain event sink.
property AddSubscriptionDataset: TDataset read write
Assign override
Copies the contents of another, similar object.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
AutoTransaction
Controls of using implicit (True
) or explicit (False
) database transactions.
property AutoTransaction: Boolean read write
CheckProperties override
Validates the event repository properties.
procedure CheckProperties
CheckSubscriptionDataset
Points to the dataset containing the SQL statement to check wether the session is subscribed to events of a certain event sink.
property CheckSubscriptionDataset: TDataset read write
ClearSessionsEvents
Removes all stored events.
procedure ClearSessionsEvents
ClearSessionsEventsDataset
Points to the dataset containing the SQL statement to remove all stored events.
property ClearSessionsEventsDataset: TDataset read write
ClearSessionsOnCreate
When set to true, this property clears all sessions stored at the moment of component creation and lets the server 'forget' all sessions at start.
property ClearSessionsOnCreate: Boolean read write
ClearSessionsOnDestroy
When set to true, this property clears all sessions stored at the moment of component destruction (usually happening at the server application/service shutdown).
property ClearSessionsOnDestroy: Boolean read write
ClearSubscriptionsDataset
Points to the dataset containing the SQL statement to remove all stored events subscriptions.
property ClearSubscriptionsDataset: TDataset read write
DeleteMessagesDataset
Points to the dataset containing the SQL statement to delete one message (event) from the storage. The message is identified by its ID.
property DeleteMessagesDataset: TDataset read write
DeleteMessagesPerSessionDataset
Points to the dataset containing the SQL statement to delete one message (event) from the storage. The message is identified by its ID and it is checked to be bound to the given session.
property DeleteMessagesPerSessionDataset: TDataset read write
DeleteOldMessages
Deletes all messages (events) created 30 days (or more) ago. The internal component's logic takes care of calling this method when needed.
procedure DeleteOldMessages
DeleteOldMessagesDataset
Points to the dataset containing the SQL statement to delete all messages (events) created before the specified date.
property DeleteOldMessagesDataset: TDataset read write
DeleteOldMessagesPerSessionDataset
Points to the dataset containing the SQL statement to delete all messages (events) bound to the specific session and created before the specified date.
property DeleteOldMessagesPerSessionDataset: TDataset read write
DeleteSessionsEventsDataset
Points to the dataset containing the SQL statement to delete the given session from the storage.
property DeleteSessionsEventsDataset: TDataset read write
DeleteSubscriptionDataset
Points to the dataset containing the SQL statement to delete (cancel) the subscription for the given session for the given event sink.
property DeleteSubscriptionDataset: TDataset read write
DeleteSubscriptionPerSessionDataset
Points to the dataset containing the SQL statement to delete (cancel) all subscriptions for the given session.
property DeleteSubscriptionPerSessionDataset: TDataset read write
DeleteUnusedMessages
Deletes all messages (events) that are not bound to any session. The internal component's logic takes care of calling this method when needed.
procedure DeleteUnusedMessages
DeleteUnusedMessagesDataset
Points to the dataset containing the SQL statement to delete all messages (events) that are not bound to any session.
property DeleteUnusedMessagesDataset: TDataset read write
DoAddSession (TGUID, IROActiveEventServer, string) protected override
Performs registration of a given session and event dispatcher.
procedure DoAddSession(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer; const aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aActiveEventServer: Custom event dispatcher
- aEventSinkId: Event sink
DoAddSession (TGUID, string) protected overload virtual (declared in TROEventRepository)
Performs registration of a given session.
procedure DoAddSession(aSessionID: TGUID; const aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
DoConvertGUID protected virtual
Called when it is necessary to convert a value of GUID type to string.
function DoConvertGUID(const aGUID: TGUID): string
Parameters:
- aGUID: The GUID value to convert.
DoGetEventData protected virtual (declared in TROEventRepository)
Retrieves data of an event for a given session.
function DoGetEventData(SessionID: TGUID; var TargetStream: TROBinaryMemoryStream): Integer
Parameters:
- SessionID: Unique session GUID
- TargetStream: Event data container
DoGetEventData2 protected override
Retrieves data of an event for a given session.
function DoGetEventData2(SessionID: TGUID; out Target: TROEventDataArray; aMaxEvents: Integer; out aEventsLeft: Integer): Integer
Parameters:
- SessionID: Session ID
- Target: Array of events
- aMaxEvents: Max possible count of eventsMax count of events per request
- aEventsLeft: Rest of events
DoRemoveSession protected override
Removes a given session from the list of registered sessions.
procedure DoRemoveSession(aSessionID: TGUID; const aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
DoStoreEventData protected override
Stores event data from a given session.
procedure DoStoreEventData(SourceSessionID: TGUID; Data: TROBinaryMemoryStream; const ExcludeSender: Boolean; const ExcludeSessionList: Boolean; const SessionList: string; const EventSinkId: string)
Parameters:
- SourceSessionID: Unique session GUID
- Data: Event data container
- ExcludeSender: If true, the
SourceSessionID
will be excluded from the destination list. - ExcludeSessionList: If true, the
SessionList
will be used as an exclusion list, otherwise as an inclusion list. - SessionList: Comma delimited list of session GUIDs
- EventSinkId: Event sink
FieldName_Created
Specifies the name of the data table field containing the event creation time. The default is 'Created'.
property FieldName_Created: string read write
FieldName_Data
Specifies the name of the data table field containing the event (message) data stream. The default is 'Data'.
property FieldName_Data: string read write
FieldName_EventSinkID
Specifies the name of the data table field containing the event sink name. The default is 'EventSinkID'.
property FieldName_EventSinkID: string read write
FieldName_MessageInc
Specifies the name of data table fields containing the event (message) identifier. The default is 'MessageInc'.
property FieldName_MessageInc: string read write
FieldName_SessionID
Specifies the name of data table fields containing the session identifier. The default is 'SessionID'.
property FieldName_SessionID: string read write
FieldName_SourceSessionID
Specifies the name of the data table field containing the session identifier for the event (message). The default is 'SourceSessionID'.
property FieldName_SourceSessionID: string read write
FieldNameSessionsCreated
Specifies the name of the data table field containing the session creation time. The default is 'Created'.
property FieldNameSessionsCreated: string read write
FieldNameSessionsData
Unused, leave default.
property FieldNameSessionsData: string read write
FieldNameSessionsLastAccessed
Specifies the name of the data table field containing the session last access time. The default is 'LastAccessed'.
property FieldNameSessionsLastAccessed: string read write
FieldNameSessionsSessionID
Specifies the name of data table fields containing the session identifier. The default is 'SessionID'.
property FieldNameSessionsSessionID: string read write
GetAllSessionsEventsDataset
Points to the dataset containing the select SQL statement to get all sessions stored.
property GetAllSessionsEventsDataset: TDataset read write
GetEventData (declared in TROEventRepository)
Implements IROEventRepository to retrieve data of events for a given session via %#DoGetEventData%.
function GetEventData(SessionID: TGUID; var TargetStream: TROBinaryMemoryStream): Integer
Parameters:
- SessionID: Session ID
- TargetStream: Target stream
GetEventData2 (declared in TROEventRepository)
Implements IROEventRepository to retrieve data of events for a given session via %#DoGetEventData2%.
function GetEventData2(SessionID: TGUID; out Target: TROEventDataArray; aMaxEvents: Integer; out aEventsLeft: Integer): Integer
Parameters:
- SessionID: Session ID
- Target: Array of events
- aMaxEvents: Max count of events per request
- aEventsLeft: Rest of events
GetEventDataEx (declared in TROEventRepository)
Retrieves data of events for a given session.
procedure GetEventDataEx(SessionID: TGUID; out Target: TROEventDataArray)
Parameters:
- SessionID: Session ID
- Target: Array of events
GetEventWriter (declared in TROEventRepository)
Retrieves an event proxy registered by the generated RODL Files.
function GetEventWriter(const IID: TGUID): IROEventWriter
Parameters:
- IID: GUID of the required interface
GetMessageIncDataset
Points to the dataset containing the select SQL statement to get the last message identifier autoincremented value.
property GetMessageIncDataset: TDataset read write
GetMessagesDataset
Points to the dataset containing the select SQL statement to get all messages (events) for the given session.
property GetMessagesDataset: TDataset read write
GetSessionsEventsDataset
Points to the dataset contianing the select SQL statement to get all data for the given session (by the session identifier).
property GetSessionsEventsDataset: TDataset read write
InsertMessagesDataset
Points to the dataset containing the SQL statement to add a new message (event) record.
property InsertMessagesDataset: TDataset read write
InsertMessagesPerSessionDataset
Points to the dataset containing the SQL statement to bind a message to the session.
property InsertMessagesPerSessionDataset: TDataset read write
IsSessionPresentinSessionManager protected (declared in TROEventRepository)
Checks given session id in SessionManager
function IsSessionPresentinSessionManager(const aSessionID: TGUID): Boolean
Parameters:
- aSessionID: Session ID.
Message (declared in TROEventRepository)
The message format used to encode event data. This must match the message format used on the client-side TROEventReceiver.
property Message: TROMessage read write
Notification protected override
Forwards notification messages to all owned components.
procedure Notification(aComponent: TComponent; Operation: TOperation)
Parameters:
- aComponent: component
- Operation: operation
OnAfterAddSession (declared in TROEventRepository)
Fired by AddSession after addition.
property OnAfterAddSession: TROSessionEvent read write
delegate: procedure OnAfterAddSession(Sender: TROEventRepository; const SessionID: TGUID)
OnAfterRemoveSession (declared in TROEventRepository)
Fired by RemoveSession after removing.
property OnAfterRemoveSession: TROSessionEvent read write
delegate: procedure OnAfterRemoveSession(Sender: TROEventRepository; const SessionID: TGUID)
OnBeforeAddSession (declared in TROEventRepository)
Fired by AddSession before addition.
property OnBeforeAddSession: TROSessionEvent read write
delegate: procedure OnBeforeAddSession(Sender: TROEventRepository; const SessionID: TGUID)
OnBeforeRemoveSession (declared in TROEventRepository)
Fired by RemoveSession before removing.
property OnBeforeRemoveSession: TROSessionEvent read write
delegate: procedure OnBeforeRemoveSession(Sender: TROEventRepository; const SessionID: TGUID)
OnCommitTransaction
Fires when a transaction should be committed. You can handle this event to determine if the transaction should be committed (default) or not.
property OnCommitTransaction: TRODBEventRepositoryTransactionEvent read write
delegate: procedure OnCommitTransaction(Sender: TRODBEventRepository)
OnConvertGUID
This event is fired when it is necessary to convert a value of GUID type to string. Handling it allows to do a custom conversion instead of the standard one.
property OnConvertGUID: TRODBEventRepositoryConvertGUIDEvent read write
delegate: function OnConvertGUID(Sender: TRODBEventRepository; const aGUID: TGUID): string
OnDatasetExecute
When a handler is assigned to this event, it is fired when the event repository needs to execute any dataset of the listed above to get or post any data. The handler is invoked instead of
the dataset execution, so the user's code becomes fully responsible for the actual execution.
property OnDatasetExecute: TRODBEventRepositoryDatasetExecute read write
delegate: procedure OnDatasetExecute(Sender: TRODBEventRepository; aDataset: TDataset)
OnDatasetGetParams
When a handler is assigned to this event, it is fired when the event repository needs a TParams object of any dataset when it is going to start filling the query parameters. The handler is invoked instead of
the standard parameters retrieval call, so the user's code becomes fully responsible for providing the valid parameters object.
property OnDatasetGetParams: TRODBEventRepositoryDatasetGetParams read write
delegate: function OnDatasetGetParams(Sender: TRODBEventRepository; aDataset: TDataset): TParams
OnDatasetSetParams
When a handler is assigned to this event, it is fired when the event repository passes the TParams object back to the dataset thus setting the query parameters. The handler is invoked instead of
the standard parameters set call, so the user's code becomes fully responsible for applying the parameters.
property OnDatasetSetParams: TRODBEventRepositoryDatasetSetParams read write
delegate: procedure OnDatasetSetParams(Sender: TRODBEventRepository; aDataset: TDataset; aParams: TParams)
OnInTransaction
Fires when a currect state of transaction is requested
property OnInTransaction: TRODBEventRepositoryInTransactionEvent read write
delegate: function OnInTransaction(Sender: TRODBEventRepository): Boolean
OnRollbackTransaction
Fires when a transaction should be rolling back. You can handle this event to determine if the transaction should be rolling back (default) or not.
property OnRollbackTransaction: TRODBEventRepositoryTransactionEvent read write
delegate: procedure OnRollbackTransaction(Sender: TRODBEventRepository)
OnStartTransaction
Fires when a transaction should be started. You can handle this event to determine if the transaction should be started (default) or not.
property OnStartTransaction: TRODBEventRepositoryTransactionEvent read write
delegate: procedure OnStartTransaction(Sender: TRODBEventRepository)
RemoveSession (TGUID) overload (declared in TROEventRepository)
Removes a given session from the list of registered sessions.
procedure RemoveSession(aSessionID: TGUID)
Parameters:
- aSessionID: Session ID
RemoveSession (TGUID, string) overload (declared in TROEventRepository)
Removes a given session from the list of registered sessions.
procedure RemoveSession(aSessionID: TGUID; aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
RemoveSessionActiveListener protected override
Removes session active listener.
procedure RemoveSessionActiveListener(Sender: TObject; aSessionID: TGUID)
Parameters:
- Sender: IROActiveEventServer instance
- aSessionID: Session ID
ROFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure ROFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
RORemoveFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure RORemoveFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SendRemoveNotification protected (declared in TROComponent)
Forwards notification messages to all owned components.
procedure SendRemoveNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SessionManager (declared in TROEventRepository)
The session manager that maintains the server's user sessions. Remoting SDK events are tied to user sessions. Fired events are stored in the session until delivered to clients, while undelivered events expire and are discarded when the session expires. Therefore, to function, every Event Repository must have a session manager assigned.
property SessionManager: TROCustomSessionManager read write
StoreAsUTCTimeStamp
Store timestamp as UTC in DB
property StoreAsUTCTimeStamp: Boolean read write
StoreEventData (declared in TROEventRepository)
Stores the provided event data in the repository.
procedure StoreEventData(SourceSessionID: TGUID; Data: TROBinaryMemoryStream; const ExcludeSender: Boolean; const ExcludeSessionList: Boolean; const SessionList: string; const EventSinkId: string)
Parameters:
- SourceSessionID: Session ID
- Data: Event data container
- ExcludeSender: If true, the
SourceSessionID
will be excluded from the destination list. - ExcludeSessionList: If true, the
SessionList
will be used as an exclusion list, otherwise as an inclusion list. - SessionList: Comma delimited list of session GUIDs
- EventSinkId: Event sink
AddSessionsEventsDataset
Points to the dataset containing the SQL statement to add a session to the repository.
property AddSessionsEventsDataset: TDataset read write
AddSubscriptionDataset
Points to the dataset containing the SQL statement to subscribe the session to events of a certain event sink.
property AddSubscriptionDataset: TDataset read write
AutoTransaction
Controls of using implicit (True
) or explicit (False
) database transactions.
property AutoTransaction: Boolean read write
CheckSubscriptionDataset
Points to the dataset containing the SQL statement to check wether the session is subscribed to events of a certain event sink.
property CheckSubscriptionDataset: TDataset read write
ClearSessionsEventsDataset
Points to the dataset containing the SQL statement to remove all stored events.
property ClearSessionsEventsDataset: TDataset read write
ClearSessionsOnCreate
When set to true, this property clears all sessions stored at the moment of component creation and lets the server 'forget' all sessions at start.
property ClearSessionsOnCreate: Boolean read write
ClearSessionsOnDestroy
When set to true, this property clears all sessions stored at the moment of component destruction (usually happening at the server application/service shutdown).
property ClearSessionsOnDestroy: Boolean read write
ClearSubscriptionsDataset
Points to the dataset containing the SQL statement to remove all stored events subscriptions.
property ClearSubscriptionsDataset: TDataset read write
DeleteMessagesDataset
Points to the dataset containing the SQL statement to delete one message (event) from the storage. The message is identified by its ID.
property DeleteMessagesDataset: TDataset read write
DeleteMessagesPerSessionDataset
Points to the dataset containing the SQL statement to delete one message (event) from the storage. The message is identified by its ID and it is checked to be bound to the given session.
property DeleteMessagesPerSessionDataset: TDataset read write
DeleteOldMessagesDataset
Points to the dataset containing the SQL statement to delete all messages (events) created before the specified date.
property DeleteOldMessagesDataset: TDataset read write
DeleteOldMessagesPerSessionDataset
Points to the dataset containing the SQL statement to delete all messages (events) bound to the specific session and created before the specified date.
property DeleteOldMessagesPerSessionDataset: TDataset read write
DeleteSessionsEventsDataset
Points to the dataset containing the SQL statement to delete the given session from the storage.
property DeleteSessionsEventsDataset: TDataset read write
DeleteSubscriptionDataset
Points to the dataset containing the SQL statement to delete (cancel) the subscription for the given session for the given event sink.
property DeleteSubscriptionDataset: TDataset read write
DeleteSubscriptionPerSessionDataset
Points to the dataset containing the SQL statement to delete (cancel) all subscriptions for the given session.
property DeleteSubscriptionPerSessionDataset: TDataset read write
DeleteUnusedMessagesDataset
Points to the dataset containing the SQL statement to delete all messages (events) that are not bound to any session.
property DeleteUnusedMessagesDataset: TDataset read write
FieldName_Created
Specifies the name of the data table field containing the event creation time. The default is 'Created'.
property FieldName_Created: string read write
FieldName_Data
Specifies the name of the data table field containing the event (message) data stream. The default is 'Data'.
property FieldName_Data: string read write
FieldName_EventSinkID
Specifies the name of the data table field containing the event sink name. The default is 'EventSinkID'.
property FieldName_EventSinkID: string read write
FieldName_MessageInc
Specifies the name of data table fields containing the event (message) identifier. The default is 'MessageInc'.
property FieldName_MessageInc: string read write
FieldName_SessionID
Specifies the name of data table fields containing the session identifier. The default is 'SessionID'.
property FieldName_SessionID: string read write
FieldName_SourceSessionID
Specifies the name of the data table field containing the session identifier for the event (message). The default is 'SourceSessionID'.
property FieldName_SourceSessionID: string read write
FieldNameSessionsCreated
Specifies the name of the data table field containing the session creation time. The default is 'Created'.
property FieldNameSessionsCreated: string read write
FieldNameSessionsData
Unused, leave default.
property FieldNameSessionsData: string read write
FieldNameSessionsLastAccessed
Specifies the name of the data table field containing the session last access time. The default is 'LastAccessed'.
property FieldNameSessionsLastAccessed: string read write
FieldNameSessionsSessionID
Specifies the name of data table fields containing the session identifier. The default is 'SessionID'.
property FieldNameSessionsSessionID: string read write
GetAllSessionsEventsDataset
Points to the dataset containing the select SQL statement to get all sessions stored.
property GetAllSessionsEventsDataset: TDataset read write
GetMessageIncDataset
Points to the dataset containing the select SQL statement to get the last message identifier autoincremented value.
property GetMessageIncDataset: TDataset read write
GetMessagesDataset
Points to the dataset containing the select SQL statement to get all messages (events) for the given session.
property GetMessagesDataset: TDataset read write
GetSessionsEventsDataset
Points to the dataset contianing the select SQL statement to get all data for the given session (by the session identifier).
property GetSessionsEventsDataset: TDataset read write
InsertMessagesDataset
Points to the dataset containing the SQL statement to add a new message (event) record.
property InsertMessagesDataset: TDataset read write
InsertMessagesPerSessionDataset
Points to the dataset containing the SQL statement to bind a message to the session.
property InsertMessagesPerSessionDataset: TDataset read write
Message (declared in TROEventRepository)
The message format used to encode event data. This must match the message format used on the client-side TROEventReceiver.
property Message: TROMessage read write
SessionManager (declared in TROEventRepository)
The session manager that maintains the server's user sessions. Remoting SDK events are tied to user sessions. Fired events are stored in the session until delivered to clients, while undelivered events expire and are discarded when the session expires. Therefore, to function, every Event Repository must have a session manager assigned.
property SessionManager: TROCustomSessionManager read write
StoreAsUTCTimeStamp
Store timestamp as UTC in DB
property StoreAsUTCTimeStamp: Boolean read write
constructor Create override
Standard component constructor
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
AddActiveListener deprecated (declared in TROEventRepository)
Registers aSessionID
as an event sink with an aActiveEventServer
instance of the IROActiveEventServer as an event dispatcher.
function AddActiveListener(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer): Boolean
Parameters:
- aSessionID: Unique session GUID
- aActiveEventServer: Custom event dispatcher
AddSession (TGUID) overload (declared in TROEventRepository)
Performs registration of a given session.
procedure AddSession(aSessionID: TGUID)
Parameters:
- aSessionID: Session ID
AddSession (TGUID, IROActiveEventServer) overload (declared in TROEventRepository)
Performs registration of a given session and event dispatcher.
procedure AddSession(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer)
Parameters:
- aSessionID: Unique session GUID
- aActiveEventServer: Custom event dispatcher
AddSession (TGUID, IROActiveEventServer, string) overload (declared in TROEventRepository)
Performs registration of a given session and event dispatcher.
procedure AddSession(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer; aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aActiveEventServer: Custom event dispatcher
- aEventSinkId: Event sink
AddSession (TGUID, string) overload (declared in TROEventRepository)
Performs registration of a given session.
procedure AddSession(aSessionID: TGUID; aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
Assign override
Copies the contents of another, similar object.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
CheckProperties override
Validates the event repository properties.
procedure CheckProperties
ClearSessionsEvents
Removes all stored events.
procedure ClearSessionsEvents
DeleteOldMessages
Deletes all messages (events) created 30 days (or more) ago. The internal component's logic takes care of calling this method when needed.
procedure DeleteOldMessages
DeleteUnusedMessages
Deletes all messages (events) that are not bound to any session. The internal component's logic takes care of calling this method when needed.
procedure DeleteUnusedMessages
DoAddSession (TGUID, IROActiveEventServer, string) protected override
Performs registration of a given session and event dispatcher.
procedure DoAddSession(aSessionID: TGUID; aActiveEventServer: IROActiveEventServer; const aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aActiveEventServer: Custom event dispatcher
- aEventSinkId: Event sink
DoAddSession (TGUID, string) protected overload virtual (declared in TROEventRepository)
Performs registration of a given session.
procedure DoAddSession(aSessionID: TGUID; const aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
DoConvertGUID protected virtual
Called when it is necessary to convert a value of GUID type to string.
function DoConvertGUID(const aGUID: TGUID): string
Parameters:
- aGUID: The GUID value to convert.
DoGetEventData protected virtual (declared in TROEventRepository)
Retrieves data of an event for a given session.
function DoGetEventData(SessionID: TGUID; var TargetStream: TROBinaryMemoryStream): Integer
Parameters:
- SessionID: Unique session GUID
- TargetStream: Event data container
DoGetEventData2 protected override
Retrieves data of an event for a given session.
function DoGetEventData2(SessionID: TGUID; out Target: TROEventDataArray; aMaxEvents: Integer; out aEventsLeft: Integer): Integer
Parameters:
- SessionID: Session ID
- Target: Array of events
- aMaxEvents: Max possible count of eventsMax count of events per request
- aEventsLeft: Rest of events
DoRemoveSession protected override
Removes a given session from the list of registered sessions.
procedure DoRemoveSession(aSessionID: TGUID; const aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
DoStoreEventData protected override
Stores event data from a given session.
procedure DoStoreEventData(SourceSessionID: TGUID; Data: TROBinaryMemoryStream; const ExcludeSender: Boolean; const ExcludeSessionList: Boolean; const SessionList: string; const EventSinkId: string)
Parameters:
- SourceSessionID: Unique session GUID
- Data: Event data container
- ExcludeSender: If true, the
SourceSessionID
will be excluded from the destination list. - ExcludeSessionList: If true, the
SessionList
will be used as an exclusion list, otherwise as an inclusion list. - SessionList: Comma delimited list of session GUIDs
- EventSinkId: Event sink
GetEventData (declared in TROEventRepository)
Implements IROEventRepository to retrieve data of events for a given session via %#DoGetEventData%.
function GetEventData(SessionID: TGUID; var TargetStream: TROBinaryMemoryStream): Integer
Parameters:
- SessionID: Session ID
- TargetStream: Target stream
GetEventData2 (declared in TROEventRepository)
Implements IROEventRepository to retrieve data of events for a given session via %#DoGetEventData2%.
function GetEventData2(SessionID: TGUID; out Target: TROEventDataArray; aMaxEvents: Integer; out aEventsLeft: Integer): Integer
Parameters:
- SessionID: Session ID
- Target: Array of events
- aMaxEvents: Max count of events per request
- aEventsLeft: Rest of events
GetEventDataEx (declared in TROEventRepository)
Retrieves data of events for a given session.
procedure GetEventDataEx(SessionID: TGUID; out Target: TROEventDataArray)
Parameters:
- SessionID: Session ID
- Target: Array of events
GetEventWriter (declared in TROEventRepository)
Retrieves an event proxy registered by the generated RODL Files.
function GetEventWriter(const IID: TGUID): IROEventWriter
Parameters:
- IID: GUID of the required interface
IsSessionPresentinSessionManager protected (declared in TROEventRepository)
Checks given session id in SessionManager
function IsSessionPresentinSessionManager(const aSessionID: TGUID): Boolean
Parameters:
- aSessionID: Session ID.
Notification protected override
Forwards notification messages to all owned components.
procedure Notification(aComponent: TComponent; Operation: TOperation)
Parameters:
- aComponent: component
- Operation: operation
RemoveSession (TGUID) overload (declared in TROEventRepository)
Removes a given session from the list of registered sessions.
procedure RemoveSession(aSessionID: TGUID)
Parameters:
- aSessionID: Session ID
RemoveSession (TGUID, string) overload (declared in TROEventRepository)
Removes a given session from the list of registered sessions.
procedure RemoveSession(aSessionID: TGUID; aEventSinkId: string)
Parameters:
- aSessionID: Session ID
- aEventSinkId: Event sink
RemoveSessionActiveListener protected override
Removes session active listener.
procedure RemoveSessionActiveListener(Sender: TObject; aSessionID: TGUID)
Parameters:
- Sender: IROActiveEventServer instance
- aSessionID: Session ID
ROFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure ROFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
RORemoveFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure RORemoveFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SendRemoveNotification protected (declared in TROComponent)
Forwards notification messages to all owned components.
procedure SendRemoveNotification(aComponent: TComponent)
Parameters:
- aComponent: component
StoreEventData (declared in TROEventRepository)
Stores the provided event data in the repository.
procedure StoreEventData(SourceSessionID: TGUID; Data: TROBinaryMemoryStream; const ExcludeSender: Boolean; const ExcludeSessionList: Boolean; const SessionList: string; const EventSinkId: string)
Parameters:
- SourceSessionID: Session ID
- Data: Event data container
- ExcludeSender: If true, the
SourceSessionID
will be excluded from the destination list. - ExcludeSessionList: If true, the
SessionList
will be used as an exclusion list, otherwise as an inclusion list. - SessionList: Comma delimited list of session GUIDs
- EventSinkId: Event sink
OnAfterAddSession (declared in TROEventRepository)
Fired by AddSession after addition.
property OnAfterAddSession: TROSessionEvent read write
delegate: procedure OnAfterAddSession(Sender: TROEventRepository; const SessionID: TGUID)
OnAfterRemoveSession (declared in TROEventRepository)
Fired by RemoveSession after removing.
property OnAfterRemoveSession: TROSessionEvent read write
delegate: procedure OnAfterRemoveSession(Sender: TROEventRepository; const SessionID: TGUID)
OnBeforeAddSession (declared in TROEventRepository)
Fired by AddSession before addition.
property OnBeforeAddSession: TROSessionEvent read write
delegate: procedure OnBeforeAddSession(Sender: TROEventRepository; const SessionID: TGUID)
OnBeforeRemoveSession (declared in TROEventRepository)
Fired by RemoveSession before removing.
property OnBeforeRemoveSession: TROSessionEvent read write
delegate: procedure OnBeforeRemoveSession(Sender: TROEventRepository; const SessionID: TGUID)
OnCommitTransaction
Fires when a transaction should be committed. You can handle this event to determine if the transaction should be committed (default) or not.
property OnCommitTransaction: TRODBEventRepositoryTransactionEvent read write
delegate: procedure OnCommitTransaction(Sender: TRODBEventRepository)
OnConvertGUID
This event is fired when it is necessary to convert a value of GUID type to string. Handling it allows to do a custom conversion instead of the standard one.
property OnConvertGUID: TRODBEventRepositoryConvertGUIDEvent read write
delegate: function OnConvertGUID(Sender: TRODBEventRepository; const aGUID: TGUID): string
OnDatasetExecute
When a handler is assigned to this event, it is fired when the event repository needs to execute any dataset of the listed above to get or post any data. The handler is invoked instead of
the dataset execution, so the user's code becomes fully responsible for the actual execution.
property OnDatasetExecute: TRODBEventRepositoryDatasetExecute read write
delegate: procedure OnDatasetExecute(Sender: TRODBEventRepository; aDataset: TDataset)
OnDatasetGetParams
When a handler is assigned to this event, it is fired when the event repository needs a TParams object of any dataset when it is going to start filling the query parameters. The handler is invoked instead of
the standard parameters retrieval call, so the user's code becomes fully responsible for providing the valid parameters object.
property OnDatasetGetParams: TRODBEventRepositoryDatasetGetParams read write
delegate: function OnDatasetGetParams(Sender: TRODBEventRepository; aDataset: TDataset): TParams
OnDatasetSetParams
When a handler is assigned to this event, it is fired when the event repository passes the TParams object back to the dataset thus setting the query parameters. The handler is invoked instead of
the standard parameters set call, so the user's code becomes fully responsible for applying the parameters.
property OnDatasetSetParams: TRODBEventRepositoryDatasetSetParams read write
delegate: procedure OnDatasetSetParams(Sender: TRODBEventRepository; aDataset: TDataset; aParams: TParams)
OnInTransaction
Fires when a currect state of transaction is requested
property OnInTransaction: TRODBEventRepositoryInTransactionEvent read write
delegate: function OnInTransaction(Sender: TRODBEventRepository): Boolean
OnRollbackTransaction
Fires when a transaction should be rolling back. You can handle this event to determine if the transaction should be rolling back (default) or not.
property OnRollbackTransaction: TRODBEventRepositoryTransactionEvent read write
delegate: procedure OnRollbackTransaction(Sender: TRODBEventRepository)
OnStartTransaction
Fires when a transaction should be started. You can handle this event to determine if the transaction should be started (default) or not.
property OnStartTransaction: TRODBEventRepositoryTransactionEvent read write
delegate: procedure OnStartTransaction(Sender: TRODBEventRepository)