|
@@ -1,17 +1,18 @@
|
|
|
+import { Interface } from "readline"
|
|
|
import { Observer, Subject, Subscribable, Unsubscribable } from "rxjs"
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
- Following intefaces pertain to an Actor messaging model.
|
|
|
+ Following intefaces pertain to messaging model.
|
|
|
Declared as interfaces so that new member elements can be
|
|
|
added. This definition only list type of messages recognised
|
|
|
by the base Actor. Messages streamed from subscribables if
|
|
|
necessary need to be mapped to message type recognised by
|
|
|
the actor.
|
|
|
|
|
|
- The concrete actor will need to add type
|
|
|
+ The concrete message will need to add type
|
|
|
of schema corresponding to each of the message type in the
|
|
|
message model (refer to src.common.messageModel.messageSchema)
|
|
|
|
|
@@ -19,24 +20,38 @@ import { Observer, Subject, Subscribable, Unsubscribable } from "rxjs"
|
|
|
|
|
|
*/
|
|
|
|
|
|
-interface messageSchemaType {
|
|
|
- undefined: "UNDEFINED"
|
|
|
- element: "ELEMENT"
|
|
|
- composite: "COMPOSITE"
|
|
|
-}
|
|
|
|
|
|
export interface MessageSchemaService extends CRUD {
|
|
|
|
|
|
}
|
|
|
|
|
|
-export class MessageSchemaDataModel {
|
|
|
- schemaId!: string
|
|
|
- schemaName!: string
|
|
|
- schemaDef!: string
|
|
|
- schemaType!: messageSchemaType
|
|
|
+export interface MessageSchema {
|
|
|
+ schemaId: string
|
|
|
+ schemaName: string
|
|
|
+ schemaDef: string
|
|
|
}
|
|
|
|
|
|
-export interface MessageSchema {
|
|
|
+export interface MessageNameSchemaMap {
|
|
|
+
|
|
|
+ message domain */
|
|
|
+ messageName: string
|
|
|
+ schemaId: string
|
|
|
+ messageDomain: string
|
|
|
+
|
|
|
+ but with different schema. */
|
|
|
+}
|
|
|
+export class MessageNameSchemMapImpl implements MessageNameSchemaMap {
|
|
|
+ messageName!: string
|
|
|
+ schemaId!: string
|
|
|
+ messageDomain!: string
|
|
|
+ constructor (schemaId: string, messageDomain: string) {
|
|
|
+
|
|
|
+ Class unique by all fields */
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export interface MessageSchemaModel {
|
|
|
|
|
|
Has reference to message schema described as interfaces.
|
|
|
MessageSchema is a network structure (not a tree hierarchy) where
|
|
@@ -45,11 +60,11 @@ export interface MessageSchema {
|
|
|
schema, or lowest node.
|
|
|
On handling version of message schema, refer to version model
|
|
|
*/
|
|
|
- messageSchemaDataModel: MessageSchemaDataModel
|
|
|
+ messageSchema: MessageSchema
|
|
|
messageSchemaService: MessageSchemaService
|
|
|
}
|
|
|
|
|
|
-export class MessageSchemaCompositeAssociation {
|
|
|
+export class MessageSchemaComposite {
|
|
|
|
|
|
messageSchema: MessageSchema
|
|
|
compositeEntries: Array <MessageSchema>[]
|
|
@@ -65,32 +80,22 @@ export class MessageSchemaCompositeAssociation {
|
|
|
- messageSchema is the container of composite entries */
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- src/common/grouping/ ============ */
|
|
|
|
|
|
-export class GroupDataModel {
|
|
|
-
|
|
|
- groupId! : string
|
|
|
- groupName! : string
|
|
|
- groupShortName! : string
|
|
|
-}
|
|
|
+export class MessageSchemaGrouping {}
|
|
|
+
|
|
|
|
|
|
-export class GroupChildDataModel {
|
|
|
- childrenList! : Array<GroupDataModel>[]
|
|
|
-}
|
|
|
|
|
|
|
|
|
-export class MessageSchemaGrouping {}
|
|
|
|
|
|
-export class MessageSchemaImpl implements MessageSchema {
|
|
|
+export class MessageSchemaModelImpl implements MessageSchemaModel {
|
|
|
|
|
|
- messageSchemaDataModel: MessageSchemaDataModel
|
|
|
+ messageSchema: MessageSchema
|
|
|
messageSchemaService: MessageSchemaService
|
|
|
-
|
|
|
- constructor (messageSchemaDataModel: MessageSchemaDataModel,
|
|
|
+
|
|
|
+ constructor (messageSchema: MessageSchema,
|
|
|
messageSchemaService: MessageSchemaService
|
|
|
) {
|
|
|
- this.messageSchemaDataModel = messageSchemaDataModel
|
|
|
+ this.messageSchema = messageSchema
|
|
|
this.messageSchemaService = messageSchemaService
|
|
|
}
|
|
|
|
|
@@ -105,10 +110,27 @@ export class MessageSchemaImpl implements MessageSchema {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ src/common/grouping/ ============
|
|
|
+
|
|
|
+ This section to be completed ....
|
|
|
+
|
|
|
+ */
|
|
|
|
|
|
+export class GroupDataModel {
|
|
|
+
|
|
|
+ groupId! : string
|
|
|
+ groupName! : string
|
|
|
+ groupShortName! : string
|
|
|
+}
|
|
|
+
|
|
|
+export class GroupChildDataModel extends GroupDataModel{
|
|
|
+ groupChildList! : Array<GroupDataModel>[]
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- src/common/services/ */
|
|
|
+
|
|
|
+ src/common/services/ ========*/
|
|
|
|
|
|
export interface CRUD {
|
|
|
|
|
@@ -139,66 +161,266 @@ export class FisError extends Error {
|
|
|
|
|
|
|
|
|
|
|
|
-export interface ActorCommands {
|
|
|
-
|
|
|
- Subscribe: "SUBSCRIBE",
|
|
|
+
|
|
|
+ Message names recognized by Actor. Names are defined
|
|
|
+ as object constants. Can be extended via object union.
|
|
|
+
|
|
|
+
|
|
|
+ file: ..src/common/fisactor/messages ========*/
|
|
|
+
|
|
|
+
|
|
|
+export const ActorFiniteState = {
|
|
|
+
|
|
|
+ For CQRS Actor which is an 'extension' to Actor,
|
|
|
+ only one command is executed at any one time.*/
|
|
|
+ Initialising: "INITIALISING",
|
|
|
+ Ready: "READY",
|
|
|
+ Executing: "EXECUTING",
|
|
|
+ Paused: "PAUSED",
|
|
|
+ ShuttingDown: "SHUTTINGDOWN",
|
|
|
+ Terminated: "TERMINATED"
|
|
|
+} as const
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+export const CommandsTemp = {
|
|
|
+ Initialise: "INITIALISE",
|
|
|
+ Start: "START",
|
|
|
+ Subscribe: "SUBSCRIBE",
|
|
|
UnSubscribe: "UNSUBSCRIBE",
|
|
|
- Initialise: "INITIALISE",
|
|
|
- Reset: "RESET",
|
|
|
- ShutDown: "SHUTDOWN"
|
|
|
+ Pause: "PAUSE",
|
|
|
+ Reset: "RESET",
|
|
|
+ ShutDown: "SHUTDOWN",
|
|
|
+ } as const
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+export type ActorMessageName = string
|
|
|
+
|
|
|
+export interface ActorMessages <T> {
|
|
|
+
|
|
|
+ Initialise: T
|
|
|
+ Start: T
|
|
|
+ UnSubscribe: T
|
|
|
+ Pause: T
|
|
|
+ Reset: T
|
|
|
+ ShutDown: T
|
|
|
+
|
|
|
+
|
|
|
+ GetActorIdentifier: T
|
|
|
+ GetActorState: T
|
|
|
+ GetSubscribables: T
|
|
|
+ GetSubscribabers: T,
|
|
|
+
|
|
|
+
|
|
|
+ QueryData: T
|
|
|
+ QuerySummary: T
|
|
|
+ QueryStatus: T,
|
|
|
+
|
|
|
+
|
|
|
+ Subscribe: T
|
|
|
+
|
|
|
+
|
|
|
+ subscriptionData: T
|
|
|
+ subscriptionSummary: T
|
|
|
+ subscriptionStatus: T
|
|
|
+
|
|
|
+
|
|
|
+ RequestReceived: T
|
|
|
+ RequestCancelled: T
|
|
|
+ RequestExeStarted: T
|
|
|
+ RequestExeEnded: T
|
|
|
+ RequestCompleted: T
|
|
|
+ RequestUnRecognised: T
|
|
|
+ RequestExecutionError: T
|
|
|
+
|
|
|
+
|
|
|
+ InternalError: T
|
|
|
+ EnvironmentError: T
|
|
|
+ UnknownError: T
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+export class ActorMessagesNameImpl <MessageName> implements ActorMessages <string> {
|
|
|
+ Initialise = "INITIALISE"
|
|
|
+ Start = "START"
|
|
|
+ UnSubscribe = "UNSUBSCRIBE"
|
|
|
+ Pause = "PAUSE"
|
|
|
+ Reset = "RESET"
|
|
|
+ ShutDown = "SHUTDOWN"
|
|
|
+
|
|
|
+
|
|
|
+ GetActorIdentifier = "GETACTORIDENTIFIER"
|
|
|
+ GetActorState = "GETACTORSTATE"
|
|
|
+ GetSubscribables = "GETSUBSCRIBABLES"
|
|
|
+ GetSubscribabers = "GETSUBSCRIBERS"
|
|
|
+
|
|
|
+
|
|
|
+ QueryData = "QUERYDATA"
|
|
|
+ QuerySummary = "QUERYSUMMARY"
|
|
|
+ QueryStatus = "QUERYSTATUS"
|
|
|
+
|
|
|
+
|
|
|
+ Subscribe = "SUBSCRIBE"
|
|
|
+
|
|
|
+
|
|
|
+ subscriptionData = "SUBSCRIPTIONDATA"
|
|
|
+ subscriptionSummary = "SUBSCRIPTIONSUMMARY"
|
|
|
+ subscriptionStatus = "SUBSCRIPTIONSTATUS"
|
|
|
+
|
|
|
+
|
|
|
+ RequestReceived = "REQUESTRECEIVED"
|
|
|
+ RequestCancelled = "REQUESTCANCELLED"
|
|
|
+ RequestExeStarted = "REQUESTEXESTARTED"
|
|
|
+ RequestExeEnded = "REQUESTEXEENDED"
|
|
|
+ RequestExeSuccessful = "REQUESTEXESUCCESSFUL"
|
|
|
+ RequestUnRecognised = "REQUESTUNRECOGNISED"
|
|
|
+ RequestExeError = "REQUESTEXEERROR"
|
|
|
+
|
|
|
+
|
|
|
+ InternalError = "INTERNALERROR"
|
|
|
+ EnvironmentError = "ENVIRONMENTERROR"
|
|
|
+ UnknownError = "UNKNOWNERROR"
|
|
|
+
|
|
|
}
|
|
|
-export interface ActorCommandStatus {
|
|
|
+
|
|
|
+export interface ActorCommands <T> {
|
|
|
+ Initialise: T
|
|
|
+ Start: T
|
|
|
+ Subscribe: T
|
|
|
+ UnSubscribe: T
|
|
|
+ Pause: T
|
|
|
+ Reset: T
|
|
|
+ ShutDown: T
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+export class ActorCommandNamesImpl <MessageName> implements ActorCommands <string> {
|
|
|
+ Initialise = "INITIALISE"
|
|
|
+ Start = "START"
|
|
|
+ Subscribe = "SUBSCRIBE"
|
|
|
+ UnSubscribe = "UNSUBSCRIBE"
|
|
|
+ Pause = "PAUSE"
|
|
|
+ Reset = "RESET"
|
|
|
+ ShutDown = "SHUTDOWN"
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+export const Commands = {
|
|
|
+ Initialise: "INITIALISE",
|
|
|
+ Start: "START",
|
|
|
+ Subscribe: "SUBSCRIBE",
|
|
|
+ UnSubscribe: "UNSUBSCRIBE",
|
|
|
+ Pause: "PAUSE",
|
|
|
+ Reset: "RESET",
|
|
|
+ ShutDown: "SHUTDOWN",
|
|
|
+ } as const
|
|
|
+
|
|
|
+export const CommandResponses = {
|
|
|
CommandReceived: "COMMANDRECEIVED",
|
|
|
CommandCancelled: "COMMANDCANCELLED",
|
|
|
- CommandExeStarted: "COMMANDEXESTARTS",
|
|
|
+ CommandExeStarted: "COMMANDEXESTARTED",
|
|
|
CommandExeEnded: "COMMANDEXEENDED",
|
|
|
- CommandCompleted: "COMMANDCOMPLETED"
|
|
|
-}
|
|
|
-export interface ActorCommandError {
|
|
|
-
|
|
|
- UnRecognisedCommand: "UNRECOGNISEDCOMMAND"
|
|
|
+ CommandCompleted: "COMMANDCOMPLETED",
|
|
|
+ UnRecognisedCommand: "UNRECOGNISEDCOMMAND",
|
|
|
CommandExecutionError: "COMMANDEXECUTIONERROR"
|
|
|
-}
|
|
|
-export interface CommandNotification {
|
|
|
- ActorCommandStatus: ActorCommandStatus
|
|
|
- ActorCommandError: ActorCommandError
|
|
|
-}
|
|
|
+} as const
|
|
|
|
|
|
-export interface ActorQuery {
|
|
|
+export const Queries = {
|
|
|
+
|
|
|
GetActorIdentifier: "GETACTORIDENTY",
|
|
|
GetSubscribables: "GETSUBSCRIBABLES",
|
|
|
GetSubscribabers: "GETSUBSCRIBERS",
|
|
|
-}
|
|
|
-export interface ActorQueriesResponse {
|
|
|
- QueryData: "GETACTORIDENTY",
|
|
|
- QuerySummary: "GETSUBSCRIBABLES",
|
|
|
- QueryStatus: "GETSUBSCRIBERS",
|
|
|
-}
|
|
|
-export interface ActorIrrecoverableError {
|
|
|
+} as const
|
|
|
+
|
|
|
+export const QueryResponses = {
|
|
|
+ QueryData: "QUERYDATA",
|
|
|
+ QuerySummary: "QUERYSUMMARY",
|
|
|
+ QueryStatus: "QUERYSTATUS",
|
|
|
+} as const
|
|
|
+
|
|
|
+export const Subscriptions = {
|
|
|
+ Subscribe: "SUBSCRIBE"
|
|
|
+} as const
|
|
|
+
|
|
|
+export const SubscriptionResponses = {
|
|
|
+ subscriptionData: "SUBSCRIPTIONDATA",
|
|
|
+ subscriptionSummary: "SUBSCRIPTIONSUMMARY",
|
|
|
+ subscriptionStatus: {
|
|
|
+ Completed: "COMPLETED",
|
|
|
+ Error: "ERROR"
|
|
|
+ }
|
|
|
+} as const
|
|
|
+
|
|
|
+export const IrrecoverableError = {
|
|
|
InternalError: "INTERNAL ERROR",
|
|
|
EnvironmentError: "ENVIRONMENTERROR",
|
|
|
- UnknownError: "UNKNOWNERROR" }
|
|
|
-export interface ActorNotification {
|
|
|
- ActorLifeCycle: ActorFiniteState,
|
|
|
- ActorIrrecoverableError: ActorIrrecoverableError
|
|
|
+ UnknownError: "UNKNOWNERROR"
|
|
|
+} as const
|
|
|
+
|
|
|
+export const StateChanged = "STATECHANGED" as const
|
|
|
+
|
|
|
+export const RequestMessages = {
|
|
|
+ Commands,
|
|
|
+ Queries,
|
|
|
+ Subscriptions
|
|
|
}
|
|
|
-export interface ActorFiniteState {
|
|
|
- Initialising: "INITIALISING",
|
|
|
- Ready: "READY",
|
|
|
- Executing: "EXECUTING",
|
|
|
- Paused: "PAUSED",
|
|
|
- ShuttingDown: "SHUTDOWN",
|
|
|
- Ended: "ENDED"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+export interface FisMessageSchema {
|
|
|
+
|
|
|
+ schemaId: string
|
|
|
+ messageName: string
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+export interface ActorMessageSchema {
|
|
|
+
|
|
|
+ T correspond to a message group such as ActorCommands */
|
|
|
+
|
|
|
+ messageType!: T
|
|
|
+ schemaId!: S
|
|
|
+
|
|
|
+ constructor (messageType: T, messageSchema: S) {}
|
|
|
}
|
|
|
-
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
-interface ActorService {
|
|
|
+
|
|
|
+
|
|
|
+export class ActorCommandServicesImpl {
|
|
|
|
|
|
To add in behaviour and model state repository */
|
|
|
+
|
|
|
+ context :ActorServicesContext
|
|
|
+
|
|
|
+
|
|
|
+ constructor (context: ActorServicesContext) {
|
|
|
+ this.context = context
|
|
|
+ }
|
|
|
+
|
|
|
+ executeCommand (command: string) {
|
|
|
+
|
|
|
+ */
|
|
|
+ return null}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+interface ActorQueryServices {
|
|
|
+
|
|
|
+ To add in behaviour and model state repository */
|
|
|
+}
|
|
|
+
|
|
|
+interface ActorSubscriptionServices {
|
|
|
+
|
|
|
+ To add in behaviour and model state repository */
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
interface ActorContext<T> {
|
|
|
|
|
@@ -208,9 +430,10 @@ interface ActorContext<T> {
|
|
|
defaultSubscribables: FisActor<T>[]
|
|
|
|
|
|
This would include the Supervisor */
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-interface ActorServiceContext {
|
|
|
+export interface ActorServicesContext {
|
|
|
|
|
|
}
|
|
|
|