Dominik Schulz > Monitoring-Spooler-0.02 > Monitoring::Spooler::Cmd::SendingCommand

Download:
Monitoring-Spooler-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: Monitoring-Spooler-0.04

NAME ^

Monitoring::Spooler::Cmd::SendingCommand - base class for any sending command

DESCRIPTION ^

This class is the baseclass for any command which sends messages to the outside.

It fetches any pending message from the DB and tries to send each message using the best transport available. In order to minimize code duplication the control flow is a bit like ping-pong.

execute fetch all waiting message from the DB using _fetch_waiting_messages which orders them by group_id. For each group _prepare_message_and_send is called with all available messages. This method is not implemented by SendingCommand but rather by it's subclasses. Insnide _prepare_message_and_send the messages may be aggreated, filtered or otherwise altered. Also this method does the escalation handling, see ...::Command::phone for an example. Inside those subclasses _send_with_best_transport SHOULD be called. This method puts the control flow back to this class which tries each transport by order of preference and tries to dispatch the message.

If all goes well the method cleanup is called with a true value, the group_id and message ref. It SHOULD remove all sent messages from the queue. This method MUST be implemented by the subclasses. See ...::Command::phone for an example.

METHODS ^

_clean_procs

Utility method. Removes all stale entries from the PID table.

_fallback_notify

Issue a HTTP GET request in case of severe failures as a measure of last resort.

_fetch_waiting_messages

Retrieve a HashRef containing all queued messages for the appropriate media-type.

This method calls the method _media_type which subclasses _MUST_ override.

_media_type

Subclasses of this class _MUST_ override this method and return a SCALAR string containing the media-type they can handle.

_send_with_best_transport

This method actually send a message. It tries all successfully initialized transports. This message should be called by the method _prepare_message_and_send which _MUST_ be implemented by subclasses.

BUILD

This method is essential in this implementation since it places this process' PID in the PID table and ensures concurrency control.

DEMOLISH

This method is essential in this implementatino since it removes our PID from the PID table.

execute

This mandatory method is called by App::Cmd. It is automatically called when the appropriate command is invoked.

NAME ^

Monitoring::Spooler::Cmd::SendingCommand - base class for any command which sends messages.

AUTHOR ^

Dominik Schulz <tex@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Dominik Schulz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: