Devanchya has asked for the wisdom of the Perl Monks concerning the following question:
I can get the message as far as 'make_a_worker' which is where the new POE::Session->create lives. I can not get this message into that session as the data for my event.
The second session is to allow me to run a number of queues at the same time dealing with the data. From inside I will be firing a Wheel to perform some very heavy CPU data work.
Looking on line, etc, I have not found a solution that seems to work.
POE::Component::JobQueue->spawn ( Alias => 'MyQueue', WorkerLimit => 3, Worker => \&make_a_worker, Passive => { }, ); ### # Job Queue Items ### sub make_a_worker { my ( $postback, $message ) = @_; POE::Session->create( inline_states => { _start => \&start_message_process, process_message => \&process_message, delay_test => \&delay_test, _end => \&end_message_process, }, ); } sub enqueue_job { my ($kernel, $session, $job) = @_[ KERNEL, SESSION, ARG0 ]; print "-enqueue_job: -- Session: ", $session->ID, " message\n"; $kernel->post( MyQueue => 'enqueue', #'remove_message', 'test_msg', $job ); } sub got_message { my ($kernel, $session, $heap, $preargs, $postargs) = @_[KERNEL, SE +SSION, HEAP, ARG0, ARG1]; $kernel->yield( enqueue_job => $postargs->[0] ); return 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: POE: Passing data from Session to Queue to New Session
by rcaputo (Chaplain) on Sep 02, 2008 at 16:35 UTC | |
by Devanchya (Beadle) on Sep 02, 2008 at 17:08 UTC |