processi

about processes and engines

Listen.java

From time to time, on the forums, there are very challenging threads, this one makes no exception : it’s about making a java application listen to OpenWFE workitems.

If you scroll down the thread, you’ll see that, in the end a fairly nice snippet of java code saw the light. I just integrated this example within the OpenWFE manual.

Of course, after this redaction exercise, I thought, there got to be a simpler way. Why not having something like :

import openwfe.org.engine.impl.listen.OwfeHook;
    //
    // OwfeHook is an abstract class 
    // its very similar to something like java.awt.event.ActionListener

(...)

    new OwfeHook(7303, "engine.host.com", 7007)
        //
        // constructor parameters are
        // listen-port, engine-host, engine-port
    {
        public void service (WorkItem wi)
        {
            System.out.println("got workitem");

            wi.getAttributes().puts("my-field", "Kilroy was here");

            // the hook takes then care of replying to the engine
            // ...
        }
    };

That’ll be for OpenWFE 1.7.1.

Now that I have put my hands on a Visual Studio environment, I’m refreshing openwfe-dotnet and I’ll write a couple listen / dispatch (as used within this OwfeHook example) for .NET. The OpenWFE engine will then be able to directly feed workitems forth and back to a .NET application.

Written by John Mettraux

May 13, 2006 at 9:24 pm

Posted in dev, openwfe

%d bloggers like this: