[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ]

Setting up a simple example

Let's create a simple example in Visual FoxPro 7.0. I want to pick up on the hospital example I brought up above, and I want to create a component that allows ordering a certain kind of medicine. Here's that component written in Visual FoxPro 7.0:

    DEFINE CLASS OrderMedicine AS Session OLEPublic
        PROCEDURE PlaceOrder(cPatient AS String, cMedicine AS String) AS VOID
            LOCAL lcOrder
            lcOrder = "Patient: " + cPatient + Chr(13) +;
                "Medicine: " + cMedicine
            StrToFile(lcOrder,"C:\MedOrder.txt")
        ENDPROC
    ENDDEFINE

As you can see, the code is very straightforward Visual FoxPro code with no Queue specific code. We simply have one method that accepts two parameters. Those parameters are received and put into a string. The string is then written to a file named C:\MedOrder.txt. This file will be our indication of the completion of the process. Obviously, this is not the equivalent of a real order process, but it is enough for demo purposes.

Now, compile the component into a multithreaded COM DLL named "Hospital.dll" (create a project named "hospital.pjx", add the PRG from above and click on "Build").

Now, start the "Component Services" administrative tool (Start/Programs/Administrative Tools/Component Services) and add a new COM+ Application by right-clicking on the COM+ Applications node and select the "New" option. Name the new application "Hospital". Then, right-click the new application, bring up the "Properties" dialog and make sure both checkboxes in the "Queuing" page are checked as in the following picture:

[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ]