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

Osgood::Client - Client for the Osgood Passive, Persistent Event Queue

DESCRIPTION

Provides a client for sending events to or retrieving events from an Osgood queue.

SYNOPSIS

  my $event = new Osgood::Event(
        object => 'Foo',
        action => 'create',
        date_occurred => DateTime->now()
  );
  my $list = new Osgood::EventList(events => [ $event ])
  my $client = new Osgood::Client(
        url => 'http://localhost',
        list => $list
  );
  my $retval = $client->send();
  if($list->size() == $retval) {
    print "Success :)\n";
  } else {
    print "Failure :(\n";
  }

METHODS

Constructor

new

Creates a new Osgood::Client object.

Class Methods

list

Set/Get the EventList. For sending events, you should set this. For retrieving them, this will be populated after querying the queue.

send

Send events to the server.

query

Query the Osgood server for events. Takes a hashref in the following format:

  {
    id => X,
        object => 'obj',
        action => 'foo',
        date => '2007-12-11'
  }

At least one key is required.

A true or false value is returned to denote the success of failure of the query. If false, then the error will be set in the error accessor. On success the list may be retrived from the list accessor.

timeout

The number of seconds to wait before timing out.

url

The url of the Osgood queue we should contact. Expects an instance of URI.

AUTHOR

Cory 'G' Watson <gphat@cpan.org>

SEE ALSO

perl(1), Osgood::Event, Osgood::EventList

COPYRIGHT AND LICENSE

Copyright 2008 by Magazines.com, LLC

You can redistribute and/or modify this code under the same terms as Perl itself.