Dispatcher

Receiver Sender no-reply

This module is used to Dispatch calls between workers. It ships data to workers only, if they are 'free' and not blocked allready

docker pull registry.goingrid.io/services/dispatcher:v0.1.0

Table of contents

Service properties

This service implements the ingrid protocol message. Following properties are being used:

Property Usage
Class Decides which workers to call
Operation If not empty, it will be added to Class with an underscore to form the called channel
Data All data will be forwarded as is to the worker / flow called

Service capabilities

This Service Manages a List of Workers. The Workers (gotmplengine) must be started in QueueManagement mode. If the Worker is Ready to accept work it notifies the dispatcher via the ‘register’ channel. The Dispatcher then adds it to the List.

If the Dispatcher is called via its Input Channel, it decides which from which List it should take a worker via the Class / Operation given. It then removes one Entry from the List and sends the Work to that Worker.

Then the Worker has finished it will pass the Result back to the original Caller.

This Service is Multithreaded, so it proccesses all incomning Requests Parallel as fast as possible (If a Worker is ready). If there is no Worker ready in a list for 5 Seconds, the Request will “Fail” and an error will be given as Response to the Caller.

Service Design

Design

Architecture

Architecture

Service configuration

Like every other service, the log service includes all properties of the service configuration and since it listens on input the input configuration.

CLI / ENV

The following parameters are specific to this worker. They can be either used environment variables (all uppercase) or within the CLI (- as prefix).

Parameter Default Description
DispatcherRegisterChannel register Channel there dispatcher receives registers for the Lists

Example K8S Manifest

kind: Deployment
apiVersion: apps/v1
metadata:
  name: test-loop-dispatch-brain
  labels:
    app.kubernetes.io/name: ingrid
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-loop-dispatch-brain
  template:
    metadata:
      labels:
        app: test-loop-dispatch-brain
    spec:
      containers:
        - name: test-loop-dispatch-brain
          image: "registry-dev.goingrid.io/services/dispatcher:latest"
          tty: true
          env:
            - name: NAME
              value: test-loop-dispatch-brain
            - name: SERVERHOST
              value: yourhiveserver
            - name: SERVERAUTH
              value: yourhiveconnectkey
            - name: LOGLEVEL
              value: DEBUG
            - name: INPUTCHANNEL
              value: "dispatch_test"