Bee agents
The bees are local or remote processes connected to hive servers
Last updated
The bees are local or remote processes connected to hive servers
Last updated
Bees are specialized processes that execute specific tasks. They are connected to a central hive server, which manages their configuration and controls the exchange of messages between them.
Bee agents interact with external services to gather and transport data in the form of messages to the hive server for further processing by other bees connected to the same hive. These agents serve as intermediaries, carrying messages between the external services and the hive server.
Communication between bee agents is facilitated by the hive server, which routes messages between the bees. These messages may contain data received from external services or the result of data processing performed by the bees.
The hive server plays a critical role in the functioning of the bee network, ensuring that messages are efficiently routed to the relevant bees for processing. Hive server is explained in section
A bee needs to be configured in order to know how to do its job. The configuration is stored in the hive server. Every time the configuration changes it is synchronized to the bee to allow it to be reconfigured.
Bee agents come in various types, each designed for specific tasks. These range from bees that communicate with third-party services to those that run code scripts or manage Docker containers. The commonality among all of them is their connection to a central hive server for configuration and inter-bee communication.
Bee agents can be broadly categorized into two groups: Connector and Worker bees.
These bees connect to external services using specific protocols, translating messages into a format that the hive can understand. They can connect to a variety of services, including databases, IoT services, and data lakes provided by different cloud providers. Different connector bees support different protocols, such as HTTP, MQTT, etc.
Worker bees are not designed to communicate with external services but instead perform specific tasks as defined in their configuration. These tasks can include executing code or managing Docker containers.
A bee is comprised of channels, each of which operates independently. The channels receive their own configuration from the hive and carry out their respective functions without knowledge of the other channels. This allows for a single bee to perform multiple tasks without the need for additional connections to the hive.
As an example, we have the Docker Client bee, where each channel controls a single Docker container. This demonstrates the ability of a single bee type to perform multiple functions simultaneously, in this case managing multiple containers.
There are bees that offer various types of channels, such as the HTTP type bee, where some channels can function as HTTP clients and others as HTTP servers.
Each bee is composed of channels and each channel is made up of routes. Routes are configured mappings between the hive messages and the messages of an external service (known as "flowers").
Each route consists of both the connection settings to the hive and the protocol-specific mappings. The connection to the hive determines the topic the bee should publish or subscribe to, as well as the network pattern. The mappings configure how to convert messages between the hive and the external service, allowing for seamless communication.
The options for configuring the mappings depend on the type of work the bee is intended to perform. The mapping will be different for a bee connecting to an OPC/UA server compared to a bee connecting to an IoT service from a cloud provider.
The bee's network pattern determines its message exchange behavior with the hive. There are several network patterns to choose from, each with a specific purpose:
Publisher: Publishes messages to hive
Subscriber: Subscribes to messages from hive
Producer: Publishes messages to the hive in a persistent and enqueued manner (streaming)
Consumer: Subscribes to persisted and enqueued messages from the hive (streaming)
Client: Sends requests to other bee services
Service: Exposes a service that receives requests from other bees
By selecting the appropriate network pattern, the bee can efficiently and effectively communicate with the hive and other bee services.
A bee can have multiple instances of itself. This allows for load balancing among different instances that work together to share the workload. In BeeOS, this concept is called a 'bee multi-instance'.
For example, if an HTTP server bee is receiving a large number of requests, load can be balanced by creating two instances of the HTTP server bee to process and send information to the hive (reducing its workload by half). When a bee has multiple instances forming a group of bees, they are seen as a single bee by the hive server, which divides its effort among the instances.
If a bee is an HTTP client that publishes messages from the hive and has multiple bee instances, the hive balances messages between all available instances.
A multi-instance bee not only serves to balance loads, but can also be used for high availability of bees if needed, similar to clustering on the hive server level.