=head1 NAME =encoding utf8 Lemonldap::NG::Common::MessageBroker - Doc for MessageBroker classes =head1 DESCRIPTION Starting from 2.20.0, Lemonldap::NG dispatches its events to other nodes using L sent by a I sub class. By default, only 2 kind of L are dispatched: =over =item * B: each time a configuration is saved. Note that default broker also adds such messages regularly following the C value I<(because it's not a real evant pub/sub system)>. This keep previous behavior. =item * B: whenever a session is terminated before it expires I<(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 I<(max 10 minutes)>. =back By default, LLNG uses only one channel, defined in C configuration parameter. During initialization, LLNG creates always 2 distinct objects: =over =item * B which calls C for each channel and then check for messages every 5 seconds =item * B which send messages on channels =back The L class contains actions to be launched when a message enter in the main events channel. =head1 METHODS Except C, all this methods must exist in a Message Broker. =head2 new Constructor. Arguments: =over =item * B<$class>: class name =item * B<$conf>: current LLNG configuration =item * B<$logger>: a Lemonldap::NG::Common logger =back =head2 publish Method to insert an L. Arguments: =over =item * B<$self> =item * B<$channel>: the channel name =item * B<$msg>: a hash reference containing the L =back =head2 subscribe Methode called during LLNG initialization for its message reader object. Arguments: =over =item * B<$self> =item * B<$channel>: the channel name =back =head2 getNextMessage Non blocking method that return a L in the given channel if one exists. Arguments: =over =item * B<$self> =item * B<$channel>: the channel name =back =head2 waitForNextMessage Blocking method that waits for a L in the given channel and return it. Arguments: =over =item * B<$self> =item * B<$channel>: the channel name =back =head2 applyConf Optional method called after configuration save. It is used only with default message broker to launch previous behavior: call all "reload URLs". =head1 MESSAGE FORMAT A message is a HASH reference. A message in the main event channel must contain a key "B". This key is used by L to launch the corresponding method. =over =item * B { action => 'newConf' } =item * B { action => 'unlog', id => '' } =back =head1 SEE ALSO L, L, L =head1 AUTHORS =over =item LemonLDAP::NG team L =back =head1 BUG REPORT Use OW2 system to report bug or ask for features: L =head1 DOWNLOAD Lemonldap::NG is available at L =head1 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 L. =cut