NAME
Lemonldap::NG::Common::MessageBroker - Doc for MessageBroker classes
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:
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 secondsa 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>' }
SEE ALSO
Lemonldap::NG::Manager, Lemonldap::NG::Portal, Lemonldap::NG::Handler
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
DOWNLOAD
Lemonldap::NG is available at https://lemonldap-ng.org/download
COPYRIGHT AND LICENSE
See COPYING file for details.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.