The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XAS::Spooler::Processor - Perl extension for the XAS environment

SYNOPSIS

  use XAS::Spooler::Processor;

  my $processor = XAS::Spooler::Processor->new(
      -schedule    => '*/1 * * * *',
      -connector   => 'connector',
      -alias       => 'nmon',   
      -directory   => 'nmon',     
      -packet_type => 'nmon-data'
  );

DESCRIPTION

This module scans a spool directory and process any files that are found. Discretionary locking is used to coordinate access to the directory. Scheduling uses cron semantics.

METHODS

new

This module inherits from XAS::Lib::POE::Service and takes these additional parameters:

-queue

The queue to send the messages too.

-connector

The alias of the connector session.

-directory

The directory to scan. The can be relative to $XAS_SPOOL or a fully qualified path.

-packet_type

The name of the message type.

-tasks

The number of sessions processing the internal queue of messages, defaults to 1 session.

-schedule

The schedule used to process items in the spool directory. This uses cron semantics and defaults to this: '*/1 * * * *'

PUBLIC EVENTS

scan(OBJECT)

Starts the directory scan process.

OBJECT

The handle for the current self.

scan_dir(OBJECT)

Reads one file from the directory and queues it to the internal processing queue.

OBJECT

The handle for the current self.

scan_dir_stop(OBJECT)

Stops the directory scan process.

OBJECT

The handle for the current self.

Removes the unneeded file from the directory.

OBJECT

The handle for the current self.

ARG0

The name of the file to remove.

process_files(OBJECT)

Removes one file from the internal queue and sends the file contents to the connector for processing.

OBJECT

The handle for the current self.

pause_processing(OBJECT)

Pauses proccessing because the connection to the message queue server is down.

OBJECT

The handle for the current self.

resume_processing(OBJECT)

Resumes processing as the connection to the message queue server is active.

OBJECT

The handle for the current self.

SEE ALSO

XAS::Spooler::Connector
XAS::Spooler
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

LICENSE AND COPYRIGHT

Copyright (c) 2012-2015 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.