I have created a Windows Service running on Windows Server 2003 using the Win32::Daemon module from http://www.roth.net/perl/Daemon.

I am using SOAP::Lite to communicate with an Apache CGI/Perl web front end for a MySQL database. In the main loop/thread, I make periodic SOAP requests to the Apache server to see if there are any jobs assigned in the database to the machine running the Windows Service daemon.

If a new job is requested, I spawn a new thread to run the job and then detach to let the main service thread loop again. In the job thread, I can communicate with the Apache server using SOAP to update the database that the job is complete.

On start up of the Windows Service, I start a new thread and detach to create a SOAP daemon using SOAP::Transport::HTTP::Daemon. This means that I can make SOAP requests into the Windows Service to get information about how many jobs have been run, time running, threads completed, thread count, etc.

I would like to be able to communicate using SOAP from the Apache CGI/Perl web front end to get the current status and administrate the Windows Service. For instance, I would like to change logging settings or tell a thread running a job to terminate the job.

My question is how do I make the design of this Windows Service clean and how do I share data between threads and packages?

Any assistance will be greatly appreciated. Thanks.


In reply to Windows Services, Win32::Daemon, Threading, and SOAP::Lite by hackdaddy

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.