logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Lemonldap::NG::Common::MessageBroker - Doc for MessageBroker classes

Authors

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

Bug Report

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

Description

       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:

       •   configurationupdates: each time a configuration is saved.

           Note  that  default broker also adds such messages regularly following the "chectTime" value (becauseit'snotarealevantpub/subsystem). This keep previous behavior.

       •   sessionlogouts: whenever a session is terminated before it expires (eitherbecausetheuserloggedoutorbyactionofanadministrator).

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

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

       During initialization, LLNG creates always 2 distinct objects:

       •   areader which calls subscribe() for each channel and then check for messages every 5 seconds

       •   awriter 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.

Download

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

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.

       •   Configurationupdate

             {
               action => 'newConf'
             }

       •   Sessionend

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

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".

Name

       Lemonldap::NG::Common::MessageBroker - Doc for MessageBroker classes

See Also

       Lemonldap::NG::Manager, Lemonldap::NG::Portal, Lemonldap::NG::Handler

See Also