Lemonldap::NG::Common::MessageBroker(3pm)

Lemonldap::NG::Common::MessageBroker3pm

Doc for messagebroker classes

Overview

Starting from 2.20.0, Lemonldap::NG dispatches its events to other nodes using messages sent by a Lemonldap::NG::Common::MessageBroker sub class.

By default, only 2 kind of messages are dispatched:

•

configuration updates: each time a configuration is saved.

Note that default broker also adds such messages regularly following the "chectTime" value (because it's not a real evant pub/sub system). This keep previous behavior.

•

session logouts: whenever a session is terminated before it expires (either because the user logged out or by action of an administrator).

Default broker just push this information on local node. Other will discover the end of session after local cache expiration (max 10 minutes).

By default, LLNG uses only one channel, defined in "eventQueueName" configuration parameter.

During initialization, LLNG creates always 2 distinct objects:

•

a reader which calls subscribe() for each channel and then check for messages every 5 seconds

•

a writer which send messages on channels

The Lemonldap::NG::Hanlder::Main::MsgActions class contains actions to be launched when a message enter in the main events channel.

Methods

Except "applyConf", all this methods must exist in a Message Broker.

new

Constructor. Arguments:

•

$class: class name

•

$conf: current LLNG configuration

•

$logger: a Lemonldap::NG::Common logger

publish

Method to insert an message. Arguments:

•

$self

•

$channel: the channel name

•

$msg: a hash reference containing the message

subscribe

Methode called during LLNG initialization for its message reader object. Arguments:

•

$self

•

$channel: the channel name

getNextMessage

Non blocking method that return a message in the given channel if one exists. Arguments:

•

$self

•

$channel: the channel name

waitForNextMessage

Blocking method that waits for a message in the given channel and return it. Arguments:

•

$self

•

$channel: the channel name

applyConf

Optional method called after configuration save. It is used only with default message broker to launch previous behavior: call all "reload URLs".

Message format

A message is a HASH reference. A message in the main event channel must contain a key "action". This key is used by Lemonldap::NG::Hanlder::Main::MsgActions to launch the corresponding method.

•

Configuration update

  {
    action => 'newConf'
  }
•

Session end

  {
    action => 'unlog',
    id => '<configuration id to be removed from local cache>'
  }

Bug report

Use OW2 system to report bug or ask for features: <https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>

Download

Lemonldap::NG is available at <https://lemonldap-ng.org/download>

Authors

LemonLDAP::NG team <http://lemonldap-ng.org/team>

From liblemonldap-ng-common-perl 2.21.2+ds-1+deb13u3 in Debian 13 (Trixie). Parsed by carta from the page's man source.