|
@@ -0,0 +1,65 @@
|
|
|
+import { Observer, Subject, Subscribable, Unsubscribable } from "rxjs"
|
|
|
+/* --------------------------------------------
|
|
|
+Fis actor to declare its own subscribable but extended from RXJS
|
|
|
+*/
|
|
|
+interface ActorService {
|
|
|
+/* Stateful actor service to be instantiated by concrete class.
|
|
|
+ To add in behaviour and model state repository */
|
|
|
+}
|
|
|
+
|
|
|
+interface ActorContext<T> {
|
|
|
+/* Environment within which actor operates. Provided by creator in
|
|
|
+ constructor */
|
|
|
+ defaultSubscribers: FisActor<T>[]
|
|
|
+}
|
|
|
+
|
|
|
+interface ActorServiceContext {
|
|
|
+/* environment within which the actor service operates */
|
|
|
+}
|
|
|
+
|
|
|
+// Please note members of an interface are ALWAYS PUBLIC.
|
|
|
+interface FisActor<T> extends Subscribable<T> {
|
|
|
+ subscribe(observer: Partial<Observer<T>>): Unsubscribable
|
|
|
+}
|
|
|
+
|
|
|
+export abstract class FisActorBaseImpl<T> implements FisActor<T> {
|
|
|
+ protected actorId!: String
|
|
|
+ /* autogenerate a GUID value upon creation */
|
|
|
+
|
|
|
+ protected actorName: String | null = null
|
|
|
+ protected incomingBus!: Subscribable<T>
|
|
|
+ protected outgoingBus!: Subscribable<T>
|
|
|
+ protected actorService!: ActorService
|
|
|
+ protected actorContext!: ActorContext<T>
|
|
|
+ protected actorServiceContext!: ActorServiceContext
|
|
|
+
|
|
|
+
|
|
|
+ constructor(actorContext: ActorContext<T>) {
|
|
|
+ // logic here
|
|
|
+ }
|
|
|
+
|
|
|
+ public subscribe(observer: Partial<Observer<T>>): Unsubscribable {
|
|
|
+ /* to subscribe from output bus for now
|
|
|
+ */
|
|
|
+
|
|
|
+ throw new Error("Method to be defined....")
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+interface Actor<T> extends Subscribable<T> {
|
|
|
+ actorId: String
|
|
|
+ actorName: String
|
|
|
+ actorStream: Subscribable<T>
|
|
|
+}
|
|
|
+
|
|
|
+abstract class Sample<T> implements Actor<T> {
|
|
|
+ actorId!: String
|
|
|
+ actorName!: String
|
|
|
+ actorStream!: Subscribable<T>
|
|
|
+
|
|
|
+ subscribe(observer: Partial<Observer<T>>): Unsubscribable {
|
|
|
+ throw new Error("Method not implemented.")
|
|
|
+ }
|
|
|
+
|
|
|
+}
|