NAME

Jenkins::NotificationListener - is a TCP server that listens to messages from Jenkins Notification plugin.

SYNOPSIS

use Jenkins::NotificationListener;
Jenkins::NotificationListener->new( host => $host , port => $port , on_notify => sub {
    my $payload = shift;   # Jenkins::Notification;
    print $payload->name , " #" , $payload->build->number, " : " , $payload->status 
                , " : " , $payload->phase
                , " : " , $payload->url
                , "\n";

})->start;

DESCRIPTION

Jenkins::NotificationListener is a simple TCP server listens to messages from Jenkins' Notification plugin,

Jenkins::NotificationListener uses AnyEvent::Socket to create tcp server object, so it's a non-blocking implementation.

This tcp server reads JSON format notification from Jenkins Notification plugin, and creates payload object Jenkins::Notification. the payload object is built with Net::Jenkins::Job, Net::Jenkins::Job::Build objects from the information that is provided from notification json.

By using Jenkins::NotificationListener, you can simple use the payload object to interact with Jenkins server.

To test your Jenkins notification plugin, you can also use jenkins-notification-listener.pl script.

$ jenkins-notification-listener.pl

EXPORTED FUNCTION

use Jenkins::NotificationListener;   # export parse_jenkins_notification function
my $notification = parse_jenkins_notification($json);
$notification;   # Jenkins::Notification object
$notification->job;
$notification->build;

INSTALLATION

$ cpan Jenkins::Notification

$ cpanm Jenkins::Notification

AUTHOR

Yo-An Lin <cornelius.howl {at} gmail.com>

SEE ALSO

Net::Jenkins

LICENSE

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