Instant messaging processor (im)

Description

Processor for exchanging instant messages with messengers.

Provides communication with messengers. Places subscriber messages received from messengers into the data model collection `/rest/v1/model/im/Messages`, and sends messages created there with `sending` status to messenger subscribers.

Creates collections/classes: im/Accounts, im/RemoteParties, im/Messages. Allows their further modification to extend the set of properties and the value variants of enumerated fields.

Uses the domain center collection `imchannels` (API, entity).

Table 1. System characteristics

Code

im

Operation mode

Service

Redundancy mode

Active-Passive.

Site types

Any

Layer

Adapter/processor

Placement

Internal

State preservation and recovery on restart

No

Application

era_im

Capabilities

  • Messages can be text, images, audio files, etc. Message text is placed in the `/im/Message` entity field, while other variants are stored as attachments (file field) and are available via `/rest/v1/model/im/Messages/ID_MESSAGE/file`.

  • Supports adding adapters for different messenger types by creating plugins (Erlang) or implementing strategies in scripts.

Limitations

  • Each individual messenger requires unique parameters that can be set in account options (the `options` field of the im/Accounts entity). In particular, for Telegram, `token` must be specified there, and optionally `disable_notification` (`true` | `false`) and `parse_mode` (`none`, `markDown`, `HTML`).

  • The platform includes a Telegram connector. Other connectors require project development and can be implemented as scripts (separately a script for receiving messages and placing them in collections, and separately a script for sending one specific message).

Parameters

Table 2. Parameters
Name Type Default Description

name

str

required

Name. May consist of Latin letters and digits and must start with a letter.

roletype

str

required

Role type. Possible values: "im".

ext

json

empty

Additional role options. Contains a JSON object or list.

enabled

bool

empty

Role activity flag. When set to false, the role does not participate in validation and is not started.

limit_of_cores

int

empty

Limit on the number of CPU logical cores used. Default: 0 - unlimited.

logging_default_level

int

empty

Default logging level set specifically for the role instance (microservice type). More

allow_divergence

bool

false

Flag allowing parameter differences in roles of the same group. Default: false - not allowed.

group

int

required

Group number.
As part of horizontal scaling, the role can be split into several groups on a site, in each of which only one instance is active and the rest are standby.
Responsibility is divided between groups by domain sets. Together all groups serve the full domain set. All roles in one group must have the same responsibility.
An integer from 1 to 9999999.

order

int

required

Order of the role instance within the group.
Determines the order in which takeover occurs in Active-Passive mode.

include_domains

array<str>

empty

List of domain names served by this group.
Any domain of any level can be specified. Specifying a domain causes its subtree to be served on this group and not on other role groups, except for branches mentioned in other groups.
Together, all role groups on the site serve the full domain tree.

takeover

bool

global

Takeover mode switch.

Failover - activation of a lower-priority service instance when the higher-priority service instance (leader of the active-passive group) is detected as unavailable.
Takeover - activation of the higher-priority service instance (leader of the active-passive group) during its recovery, accompanied by stopping the service on the lower-priority service instance.

  • If the mode is enabled, takeover is performed automatically.

  • If the mode is disabled, takeover is not performed; the recovered group leader temporarily becomes a follower and waits for the service to be unloaded on the lower-priority instance.

  • If the option is not set, its value from the current site parameters is used. If it is not set on the site, the value from the general section is used. If it is not set anywhere, takeover is enabled for more accurate load distribution according to the configured priorities.

domain_group

int

group

Domain distribution group number. Instances with the same value share the domain subtree (include_domains) as one group. Defaults to the group number.
An integer from 0.

Configuration example

Configuration management is performed in an application available to master domain administrators. The application hides the full configuration content, but it is still available through the API.

The configuration contains a section describing all instances of all roles. Parameters are defined for each specific role instance.

Node example
{
  "name": "im1",
  "roletype": "im",

  "group": 11330,
  "order": 1
}

See also