Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Implementing a queue based system

by chanakya (Friar)
on Mar 23, 2005 at 09:02 UTC ( [id://441710]=perlquestion: print w/replies, xml ) Need Help??

chanakya has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I'm developing an application where I need to put incoming messages onto a message queue.
I was looking at the MQSeries::Queue
I was just wondering if there are any other modules for the same.

Basically using the module I've to do the following operation:

=> Get the incoming message and put it in a message queue. A script will check
the queue and if there is any message existing (message is nothing but an XML file),
it will parse the message and put the results in the Database.

Please let me know regarding the same. Any sample code will be of much help.

Regards

Replies are listed 'Best First'.
Re: Implementing a queue based system
by Corion (Patriarch) on Mar 23, 2005 at 09:10 UTC

    What you get by MQSeries is a whole infrastructure and safe distribution and delivery of messages. If you don't already have an MQSeries infrastructure set up, then MQSeries::Queue will be of no use to you.

    One convenient mechanism of message passing via store-and-forward is SMTP, which already has a big supporting infrastructure set up, another convenient mechanism might be a file system scheme like the following:

    incoming/ arrived/ processing/ processed/

    Files get written into the incoming directory, and moved into the arrived directory once they have arrived completely. The importing application moves a file into the processing directory and then starts working on the file. After the file has been processed, it is moved into the processed directory. This setup makes monitoring the whole process quite convenient, as no file may be in any directory other than processed for longer than five minutes (or so).

    The SOAP::Lite modules also implement a message transport over various media.

    But as you don't state what your requirements for the message transport are, there really is no way of telling what might be suitable to your needs.

      Corion

      Than you for the reply. The requirement is simple, SOAP::Lite server will accept a SOAP message from the client and put it in a queue. Another script will check if the queue/folder is not empty, pick the message, parse it and update the database.

      Do you think any CPAN module will help me in achieving this setup

      Thanks
Re: Implementing a queue based system
by TilRMan (Friar) on Mar 23, 2005 at 13:53 UTC

    Take a look at IPC::DirQueue. I've never used it, but it looks like it should do the trick.

      Thank you everyone for the suggestions.
      I've took a look at IPC::DirQueue and it looks impressive.
      Thanks TilRMan
Re: Implementing a queue based system
by gellyfish (Monsignor) on Mar 23, 2005 at 13:47 UTC

    You might want to consider using D-Bus which is a message queuing system and the as yet unreleased Perl API - I'm sure if people started using it the guy will release to CPAN.

    /J\

Re: Implementing a queue based system
by perlfan (Vicar) on Mar 23, 2005 at 18:03 UTC
    It sounds like your queue needs are pretty simple. You could simply use an array to push/shift entries off - FIFO style. You could even use DBM::Deep for some persistence.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://441710]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found