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...