Skip to main content
Version: 2.7

Process

Index

Constructors

constructor

Methods

staticconnect

  • connect(): Promise<void>
  • Static method that manually triggers a connection attempt to the server to go ONLINE. If you have called Process.disconnect() before, it will cancel the OFFLINE mode, next time the app will be opened, it will try to go ONLINE on its own.

    Returns a promise that resolves when the server connection is established. If it fails, the promise is rejected.


    Returns Promise<void>

staticdisconnect

  • disconnect(): Promise<void>
  • Static method that manually close the connection to the server to go OFFLINE. Persists the offline status so the app restart offline after being closed. The only way to clean that status is to call Process.connect().

    Returns a promise that resolves when the server connection is indeed disconnected and the state is OFFLINE. If the flag offline.enabled is not set to true, the promise is rejected.


    Returns Promise<void>

staticisOnline

  • isOnline(context: Context): Observable<boolean>
  • Static method that returns an observable on the connection state: the observable send TRUE if the process is considered as ONLINE and false if not.


    Parameters

    • context: Context

      the context of the brick to garbage collect the observable when not needed anymore.

    Returns Observable<boolean>

staticonHealthCheck

  • onHealthCheck(callback: () => Promise<string>, healthCheckId?: string): () => void
  • Static method to register a callback that is used to check the health status of the process. This is typically used by kubernetes environment to maintain backend healthy

    The callback must return a Promise which returns a string as valid message. The process is considered by the runtime as unhealthy if the promise is rejected.


    Parameters

    • callback: () => Promise<string>

      the callback executed each time the runtime check the health of the process.

    • optionalhealthCheckId: string

      optional id to name the healthCheck hook, mainly for debug purpose

    Returns () => void

      • (): void
      • Static method to register a callback that is used to check the health status of the process. This is typically used by kubernetes environment to maintain backend healthy

        The callback must return a Promise which returns a string as valid message. The process is considered by the runtime as unhealthy if the promise is rejected.


        Returns void

staticonShutdown

  • onShutdown(callback: () => Promise<void>, shutdownId?: string): () => void
  • Static method to register a callback called by the runtime when it receives the signal to be terminated. This is typically used to graceful shutdown some connections or drivers to external processes.

    The callback must return a Promise which is resolved when the shutdown process is done.


    Parameters

    • callback: () => Promise<void>

      the callback executed when the runtime terminates.

    • optionalshutdownId: string

      optional id to name the shutdown hook, mainly for debug purpose

    Returns () => void

      • (): void
      • Static method to register a callback called by the runtime when it receives the signal to be terminated. This is typically used to graceful shutdown some connections or drivers to external processes.

        The callback must return a Promise which is resolved when the shutdown process is done.


        Returns void