Client

Overview

The client module bundles the client daemon and a couple code modules needed to run it. The client itself is meant to be extended by plugins using the clacks.common.components.plugin.Plugin interface. When starting up the system, the client looks for plugins in the setuptools system and registers them into to the clacks.common.components.registry.PluginRegistry.

After the PluginRegistry is ready with loading the modules, it orders them by priority and loads them in sorted order.

The client is now in a state where it enters the main loop by sending an AMQP ClientAnnounce event to be recognized by agents.

To provide services an ordinary client will load a couple of modules exposing functionality to the outside world. Here are some of them:

  • clacks.client.command.CommandRegistry inspects all loaded modules for the clacks.common.components.command.Command() decorator and registers all decorated methods to be available thru the CommandRegistry dispatcher.
  • clacks.client.amqp_service.AMQPService joins to the qpid broker federation and provides methods to speak with the bus.

This happens automatically depending on what’s registered on the [client.module] setuptools entrypoint.

The client will send a ClientLeave event when shutting down.

If you’re looking for documentation on how to write plugins, please take a look at the Plugin section.

Joining clients

Before a clacks client can connect to the AMQP bus, it needs to be known to the infrastructure - which is done by joining the client. The process of joining is like joining a windows client to a domain: you need someone with adequate permission to do that.

While the clacks-join binary will do this for you, it is possible to extend it to use i.e. a graphical join dialog. At present, we provide a ncurses and a readline based join mechanism. More can be added using the setuptools join.module entrypoint. For more information, take a look at the clacks.client.join and clacks.client.plugins.join.join_method documentation.

Using the binaries

The clacks-client binary gets installed when you run the setup process. It has a couple of command line arguments:

$ clacks-client --help
usage: clacks-client - the clacks core daemon

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -c FILE, --config FILE
                        read configuration from FILE [/etc/clacks]
  --url URL             AMQP broker URL
  --profile             write profiling information [False]

Note

Take a look at the quickstart to see how the client is controlled.

For production environments, just start the client using the supervisor package.


Contents: