2.2.9 • Published 2 years ago

dyna-process-manager v2.2.9

Weekly downloads
2
License
MIT
Repository
-
Last release
2 years ago

DynaProcessManager(config?: IDynaProcessManagerConfig)

interface IDynaProcessManagerConfig {
  loggerSettings?: IDynaLoggerConfig;
}

IDynaLoggerConfig

public addProcess(processSetup: IDynaProcessConfig): DynaProcess

interface IDynaProcessConfig {
  name: string;               // The name if this process for console messages and stats
  cwd: string;                // Current working directory of the child process
  command: string;            // Full executable filename
  args?: string | string[];   // Arguments
  env?: any;                  // Environment key-value pairs
  guard?: IDynaProcessConfigGuard;
  forceTerminationSignal?: boolean;     // default: false, Force passing the termination signal to child process
  loggerSettings?: IDynaLoggerSettings;
  consolePrefixProcessName?: boolean;   // default: true
  onClose?: (exitCode: number, signal: string) => void;
}

interface IDynaProcessConfigGuard {
  restartAfterMs: number;
}

addProcess returns the insatnce of the DynaProcess where this has the id property (string). Use this id in the below methods.

public removeProcess(id: string): Promise

public getProcess(id: string): DynaProcess

public get count(): number

public stopAll(): Promise

DynaProcess

You don't instantiate this, this is the result of the addProcess.

You get this from getProcess by its id.

logger: DynaLogger

get id(): string

public active: boolean

get info()

Returns startAt, stoppedAt and stopCalled

start(): Promise

Returns true if started and false if it was already started.

The process is started automatically on addProcess.

You can use this if you to re-start it later.

stop(signal?: string): void

Pass object to new instances

Classes needs at list an config/opt/settings object to start and work. Since this will start in new process, you can pass only string arguments.

There two utils provided from the library that can help you to serialize/deserialize an object.

encodeDataToString = (data: TData): string

Converts an object to string.

Pass this string as argument to the process and read it from the process.argv.

Then decodeStringToData.

decodeStringToData = (encoded: string): TData

Converts a string to object.

2.2.9

2 years ago

2.2.7

2 years ago

2.2.6

2 years ago

2.2.8

2 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.1

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.1.1

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago