Your correct. Let me try to summarize it.

- The XML message is a short message coming in from a publication system. There can be hundreds of message a minute. The XML message is the main event for the application
- The XML message needs to be handled in a FIFO system if possible. I put the message into the POE::Queue::Array and check incoming messages to see if they are already in the array to prevent duplicates.
- A wheel will be created that runs a command line vendor that is very CPU intensive. We can only run X amount per server.

The code sample is my very basic poe setup. As you can see how to handle what is going into the Queue is not here... this is where I am getting lost. Thanks for any help...

POE::Session-create( inline_states => { _start => \&task_start, subscribe => \&subscribe, inmessage => \&inmessage, # some other events ... }, ); my $pq = POE::QUEUE::Array->new(); $poe_kernel->run(); exit; sub task_start { my ($kernel, $heap) = @_[KERNEL, HEAP]; $kernel->yield('xmlmsg_open'); } sub xmlmsg_open { my ($kernel, $session) = @_[KERNEL, SESSION]; # Code for a Vendor based XML message connect # Includes a call to a seperate function that opens the subscription +_check } sub subscribe { my ($kernel, $heap, $session, $prearg, $postargs) = @_[KERNEL, HEAP. +..etc]; $kernel->post( $alias => 'subscribe', InXMLMessageCallBack => $session->postback('inmessage' $alias) +, # Other postbacks ); } sub inmessage { my ($kernel, $session, $heap, $preargs, $postargs) = @_[KERNEL, SESSI +ON, HEAP...]; $msg = $postargs->[0]; # code that reads something called getBody from the XML and determin +es the priority of the message. $pq->enqueue( $priority, $msg->getBody); return 1; }
Even smart people are dumb in most things...

In reply to Re^2: POE, POE::Queue and long running tasks. by Devanchya
in thread POE, POE::Queue and long running tasks. by Devanchya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.