Thread Coordinator

General description

Thread Coordinator is a component responsible for managing threads owners. The application provides API for getting current thread owner as well as passing a thread to someone else (e.g. from bot to agent).

API

Default port: 5762

The application has got HTTP API which is not secured by any mechanism, therefore should NOT be visible from outside the Kubernetes cluster.

There are default endpoints for monitoring purposes. They are described in Components monitoring section.

Databases

SQL

The component has its own SQL Database for storing information about thread owners.

Main Tables:

  • thread_events - events about conversation ownership (Human or Bot)

RabbitMQ

The component reads data from queues:

  • automate.jobs.XXX - used for handling jobs from cron-orchestrator

The component writes data to queues:

  • automate.jobs.result - used for returning status to cron-orchestrator

Communication

This service communicates with the following services:

ApplicationConfig to URLAuth
hooks-serverchatbots.thread-coordinator.hooks.hooks-receivers.urlOTP

Config

Application's config:

chatbots.thread-coordinator {
  db {
    url: "jdbc:postgresql://db:5432/chatbots-thread-coordinator",
    user: "postgres",
    password: "root"
    max-connections: 20
  }
  
  thread-events {

    # duration, after which thread events are deleted
    delete-after: 183d

    # defines durations per source type, after which threads are returned from Agent to Bot
    return-after: {

      # special entry defining default duration for all sources
      default: 7d
    }
  }
  
  hooks {
    hooks-receivers: [
    	{
      	url: "https://REACT_HOOKS_SERVER_PUBLIC_URL/automate"
        # Please make sure it matches with OTP Secret set in SentiOne's config.yaml key: hookServer.automate.otpSecret
        otp-secret: "PUT_SECRET_HERE"
      }
    ]
    hooks-request-timeout: 30s        
  }
}

Other required configurations:

chatbots.messaging {  
  rabbit {  
    hosts: ["HOST:PORT"]  
    username: "USER"  
    password: "PASSWORD"  
  }  
}

Play Framework config

More information about Play Framework could be found in Play Framework configuration section

Job execution

CleanThreadCoordinatorEvents

This cron job is executing in this component. It removes thread events older than setting chatbots.thread-coordinator.thread-events.delete-after

ReturnThreadsToBot

This cron job is executing in this component. It returns threads to Bot after duration defined in configuration chatbots.thread-coordinator.thread-events.return-after