To migrate the C++ daemon, Resin includes some utilities to run tasks  
(Java classes in the end) periodically, we have also used Open  
Symphony's Quartz scheduler to develop such thing in a container  
independent way. The benefit of it is that you don't have to care  
about two different pieces of software. OTOH, if you have to have the  
server running independently of the servlet container, then a Java  
application running as a service daemon would do fine.

Regarding using PHP for the business logic, the approach we have  
experimented with is to call the Quercus engine through the Java  
Scripting Interface and return XML from that, which is then fed to  
FreeMarker/XSLT to generate the output. We have not developed it  
specifically for PHP, it works with any scripting language, but PHP is  
just fine if you have PHP resources and want to re-use them.

One could use PHP directly through the Quercus servlet, but that would  
mean no SoC, and we want it.

We have a mini-example application that uses it and the framework that  
does the work is also Open Source, in case you wanted to have a look  
at it and see how it's done.

We had no PHP resources so we are not currently using the language  
itself, but we use it with Groovy and it is "conceptually" the same.

BTW: There's a memory leak in version 3.1.5/6 when Quercus is called  
through the Java Scripting API, so don't test the combination with  
that version. Not sure if the leak is still present in latest version  
as I had no time to test it yet.  


S'està citant Emil Ong <[EMAIL PROTECTED]>:

> On Thu, Sep 04, 2008 at 06:06:04PM +0200, Clemens Perz wrote:
>> Hi Guys!
>> I am playing around with Resin/Quercus now for a few days, trying to
>> make one of my PHP applications work in this environment.
>> It consists out of two parts, a traditional web frontend that I think I
>> will get up and running with Resin.
>> The other part is a TCP server, which I usually start through inetd or a
>> daemon written in C++. All the logic for the server is pure PHP.
>> Do you think I can port this to be controlled by a daemon/service
>> written in Java and still have the logic in PHP, processed by Quercus?
>> Could you give me any hints how to approach this? Where could be
>> pitfalls, what kind of wrappers you think I might have to write?
>> Any information that helps would be highly welcome :))
> Hi Clemens,
> This can be done in Resin, but it will take a bit of work.  First,
> you'll need write a custom protocol.  Resin has a facility that lets
> you do that and configure it pretty easily:
> http://www.caucho.com/resin/examples/custom-protocol/index.xtp
> Next, you'll need to integrate Quercus into that protocol.  There are
> a couple ways of doing that, but the easiest would probably be to use the
> javax.script interface.  You'll just use the "Quercus" engine for the
> language.  Looks like we don't have an example up for that yet, so I'll
> throw a quick one up on the blog (http://blog.caucho.com/) later today.
> If you have experience with javax.script though, it should be pretty
> straight forward.
> Keep us updated on your progress!  It sounds like a very interesting
> project.
> Emil
> ============================================================
> Emil Ong
> Chief Evangelist
> Caucho Technology, Inc.
> Tel. (858) 456-0300
> http://blog.caucho.com/
> Caucho: Reliable Open Source
> --> Resin: application server
> --> Quercus: PHP in Java
> --> Hessian Web Services
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest


resin-interest mailing list

Reply via email to