Check the return value of IKC call to spectre

This commit is contained in:
Paul Driver 2011-05-23 12:51:56 -05:00
parent 1fa911029d
commit edcf276a2f
2 changed files with 7 additions and 13 deletions

View file

@ -677,14 +677,9 @@ sub start {
# hand off the workflow to spectre # hand off the workflow to spectre
$log->info('Could not complete workflow instance '.$self->getId.' in realtime, handing off to Spectre.'); $log->info('Could not complete workflow instance '.$self->getId.' in realtime, handing off to Spectre.');
my $spectre = WebGUI::Workflow::Spectre->new($self->session); my $spectre = WebGUI::Workflow::Spectre->new($self->session);
$spectre->notify("workflow/addInstance", {cookieName=>$self->session->config->getCookieName, gateway=>$self->session->config->get("gateway"), sitename=>$self->session->config->get("sitename")->[0], instanceId=>$self->getId, priority=>$self->{_data}{priority}}); my $success = $spectre->notify("workflow/addInstance", {cookieName=>$self->session->config->getCookieName, gateway=>$self->session->config->get("gateway"), sitename=>$self->session->config->get("sitename")->[0], instanceId=>$self->getId, priority=>$self->{_data}{priority}});
my $spectreTest = WebGUI::Operation::Spectre::spectreTest($self->session); return $success ? undef : WebGUI::International->new($self->session, "Macro_SpectreCheck")->get($spectreTest);
if($spectreTest ne "success"){
return WebGUI::International->new($self->session, "Macro_SpectreCheck")->get($spectreTest);
}
return undef;
} }
1; 1;

View file

@ -54,7 +54,8 @@ sub DESTROY {
=head2 notify ( module, params ) =head2 notify ( module, params )
Sends a message to Spectre. Sends a message to Spectre. Returns true iff the message was successfully
sent.
=head3 module =head3 module
@ -78,12 +79,10 @@ sub notify {
timeout=>10 timeout=>10
); );
if (defined $remote) { if (defined $remote) {
my $result = $remote->post($module, $params); my $result = $remote->post($module, $params);
unless (defined $result) { return 1 if defined $result;
$error->warn("Couldn't send command to Spectre because ".$POE::Component::IKC::ClientLite::error); $error->warn("Couldn't send command to Spectre because ".$POE::Component::IKC::ClientLite::error);
} }
$remote->disconnect;
undef $remote;
} else { } else {
$error->warn("Couldn't connect to Spectre because ".$POE::Component::IKC::ClientLite::error); $error->warn("Couldn't connect to Spectre because ".$POE::Component::IKC::ClientLite::error);
} }