I have an implementation issue regarding how to handle non-POE-safe SOAP
requests in a daemon.  I would greatly appreciate your insight.

As indicated in some of my previous postings, I have a preliminary
adaptation of Fletch's PoCo::SOAP to use Rocco's PoCo-Server-TCP.  This
turned out to require very little coding, which illustrates the benefit
of having these PoCo's.

However, this initial implementation is rather naive in dispatching SOAP
requests.  It does not check whether the dispatched call is POE safe, so
it's possible for POE to block.

One way to resolve this issue, is to use POE::Wheel::Run and to handle
each SOAP request within the forked process, and collect the response
using some mechanism such as Cache::Cache.  This takes care of
non-POE-safe requests.

One of the pitfalls I see is that some SOAP requests require
interactions with the daemon process itself or run quickly enough to be
POE safe.  In these cases, it may not be desirable to run them in
Wheel::Run.  I need some way to distinguish POE-safe requests from
non-POE-safe requests.

So what's the best way to mark subroutines as POE-safe?

One idea is to use the "attributes".  So for POE-safe functions, I may
have:

  package foo;
  sub bar : POE_safe { ... }

In this case, most likely I will have to install Attribute::Handlers and
define a handler for "POE_safe".  The handler will then register these
functions as POE-safe.

A less fancy way of doing this may be simply having a package global
variable @POE_safe which contains all the POE-safe subroutine names.

What do you think?  Any suggestion?  TIA.

Pete


Reply via email to