[Zope] Persistent method

Roelof Naudé roelof.naude@epiuse.com
Thu, 26 Aug 1999 16:10:22 +0200


> > Hi
> > 
> > Is it possible to have a persistent method/class/process 
> running in the ZOPE
> > framework?
> 
> Sure.
> 
> > For example an online trading site would have some connectors
> > (CORBA or XLMRPC) to an external system to do the trades. 
> The connectors can
> > be a python class. This class will place an order and have 
> to wait for a
> > reply, but since a reply can take too much time, one would have an
> > asynchronous call. The class/process still needs to stay 
> resident so that it
> > can act on the reply, e.g. write reply to database/send 
> mail to users etc.
> > Also it could monitor clients portfolios and send e-mail or 
> some other
> > notification when a specific share is above or below a 
> certain threshold.
> 
> How this was coded would depend on whether it was truly 
> asynchronous or not.
> For things like monitoring potfolios, you may wish to simply 
> start a Python thread
> that makes the external connection and waits for inputs.  
> This thread would make
> connections to the object database as needed to handle 
> specific events.
> If you need the response to the external call to create a web 
> response, then 
> you will need to have web requests lock till you get a reply. 
>  This requires
> some tricky coding but may avoid the need for a dedicated 
> thread. You may need
> a combination of these approaches.
> 
> If you can test for external events via a select call, you 
> should be able
> to recieve external events via the asyncore main loop used by ZServer.
> This would avoid the need for a dedicated thread and probably simplify
> event handling a bit.
> 
Thanx. I'm new to ZOPE, just started out...exploring the possibilities.
Where would one add threads or persistent processes in the ZOPE framework?

Roelof