http://qs1969.pair.com?node_id=709071


in reply to POE, Sessons, POE::Wheel::Run and program flow

sub make_a_worker { my ( $postback, $message ) = @_; POE::Session->create( inline_states => { _start => \&worker_start, worker_child_stdout => \&worker_child_stdout, worker_closed => \&worker_closed, sig_child => \&sig_child, }, args => [ @_ ], ); } sub worker_start { my ($kernel, $session, $heap, @args ) = @_[KERNEL, SESSION, HEAP, +ARG0 .. $#_]; $heap->{postback}=$args[0]; $heap->{message}=$args[1]; $heap->{MessageID} = $args[1]->getHeaderField('MessageID'); $heap->{SessionID} = $session->ID; # ... your code as is... print " Message ID: ".$heap->{MessageID}; print " -start_message_process (end): ".$heap->{SessionID}."\n"; } # .... sub worker_closed { my ( $kernel, $heap) = @_[ KERNEL, HEAP]; my $postback=$heap->{postback}; my @results=@{$heap->{results}}; # I don't know how $heap->{results} is created, but I presume it i +s based somehow on the output of your process $postback->(@results); # ... anything you need (yield('sig_child') is not one of that) }


This should do it.

Your problems, create a session (and that include almost any type of component don't ways for the session to end, one create it and add it to the sessions poll, so when you call your callback after create the session you are signaling the JobQueue that the job is done.

Replies are listed 'Best First'.
Re^2: POE, Sessons, POE::Wheel::Run and program flow
by Devanchya (Beadle) on Sep 04, 2008 at 17:59 UTC
    That did it! Thanks.
    Even smart people are dumb in most things...