my $fid = $job->{fetcher}; my $fdata = $heap->{FETCHERS}->{$fid}; delete $fdata->{jobs}->{$job->{id}}; delete $fdata->{dispatched}->{$job->{id}}; $heap->{FETCHER_STATUS}[$fid]--;
NAME
Xango::Broker::Base - Base Class for Xango Broker
SYNOPSIS
package MyBroker;
use strict;
use base qw(Xango::Broker::Base);
DESCRIPTION
Xango::Broker::Base implements the common broker methods.
You should be using Xango::Broker::Pull or Xango::Broker::Push in your applications. See respective documentations.
OBJECT METHODS
spawn(%args)
Create a new Xango::Broker::Base object, and also spawn a new POE::Session using that new object. To start a Xango::Broker session, you should be using spawn(), and not new().
Accepts the same arguments as new().
new(%args)
Create a new Xango::Broker::Base object. Arguments passed to it are stored via initialize()
- Alias (scalar)
-
The POE session alias for the broker.
- ConfigFile (scalar)
-
Path to the config file used by Xango::Config. Values in this file will be used as the default value for other variables.
- DnsCacheClass (scalar)
-
Perl class to use for DNS cache.
- DnsCacheArgs (hashref | arrayref)
-
Arguments to the DNS cache constructor
- DnsCacheArgsDeref (boolean)
-
Try to de-reference the DNS cache constructor argument specified by DnsCacheArgs when creating the cache. This is required if your DNS cache class uses simple list values instead of hash/array refs (e.g. Cache::Cache and Cache::FastMmap)
- DnsCompClass (scalar)
-
Specify the POE component class to asynchronously resolve DNS requests. By default POE::Component::Client::DNS is used.
- HandlerAlias (scalar)
-
The POE session alias for the handler.
- HttpCompClass (scalar)
-
Specify the POE component class to handle the actual HTTP fetching. By default POE::Component::Client::HTTP is used.
- HttpCompArgs (hashref | arrayref)
-
Arguments to the HTTP fetching component constructor.
- MaxHttpComp (scalar)
-
Max number of HTTP components to spawn.
initialize
Initializes the broker object.
attr(key => $value)
General purpose getter/stter for attributes.
dns_comp_class
The class name for DNS resolver component.
dns_comp_alias
The alias for DNS resolver component.
states
Returns the states list as passed to the POE::Session constructor.
STATES
States are all called either by yield() or post(). The arguments described below are to be used in that context, i.e. yield('state', $arg1, $arg2...)
check_job_type
create_dns_cache
Creates and sets the DNS cache. You probably don't need to worry about this.
create_http_comp_data
create_http_request
Creates a new HTTP::Request object to be fetched.
dispatch_http_fetch($job)
Start an HTTP fetch for $job. $job must have a HTTP fetcher associated to it.
dispatch_to_lightest_load($job)
Choose the HTTP fetcher session with the least load, and call dispath_http_fetch after associating it to a job
fake_error_response
Create a fake HTTP error response, which is passed to handle_http_response. This is used to notify internal errors to the handler.
install_sighandlers
Installs the global signal handlers.
spawn_dns_comp
Spawns the component to resolve DNS lookups.
spawn_http_comp($howmany)
signal_http_comp
Send a signal to the specified HTTP component.
handle_dns_response
handle_http_response
handle_signal
Handle a given signal. The signal name is in ARG0.
register_dns_request
register_http_request
unregister_http_request
finalize_job
SEE ALSO
Xango::Broker::Pull Xango::Broker::Push
AUTHOR
Copyright (c) 2005 Daisuke Maki <dmaki@cpan.org>. All rights reserved. Development funded by Brazil, Ltd. <http://b.razil.jp>