Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM+ Events and multiple subscribers
Message
From
30/10/2001 10:35:56
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
COM+ Events and multiple subscribers
Miscellaneous
Thread ID:
00575067
Message ID:
00575067
Views:
53
I've been looking at the details of COM+ Events with PERSISTENT Subscribers.
In particular I was concerned about a failure in one of the SUBSCRIBERS and if/how that fact (of failure) would be transmitted back to the event PUBLISHER.

To (hopefully) find out I revised the standard samples as follows:
  • Revised "PriceChange.scx" "Command1.Click" method to check the return value after calling the oPublisher.PriceChange 'event'.
    A WAIT window is displayed if the return is FAIL.
    Recompiled.
  • Revised the "book_pub.prg" in the FoxBook_Pub project to have "...As Integer" for the return for the 2 methods it contains.
    Rebuilt as MTDLL Server.
  • Revised "book_sub1" of the FoxBook_Sub project to also include the "...As Integer" in their method declaration statements.
    Also changed the code in each method to return a FAILed HRESULT under the specific circumstance that the dollar part of price of the book is exactly divisible by 4, else return a SUCCESS value.
    Rebuilt as MTDLL Server.
  • Duplicated "book_sub1" as "Book_sub2" in a new project (duplicate of foxbook_sub, named Foxbook_sub2).
    Changed the 'exactly divisible by' value to be 3.
    Rebuilt as a MTDLL Server.
    Added the application to COM+ directory.
    Added FoxbookSub2 as a subscriber to IBookpub. Note that in doing so I found that the (original) FoxBookSub1 subscription had disappeared (as a result of the rebuild, I guess) so I deleted it and re-added it again.

    Once this was done I ran the test form "DO FORM BOOKS" and I clicked the Change Price button.
    I then changed the price of a book to a dollar value NOT divisible by 3 or 4 and, on checking the LOG, found 2 entries as expected. This proved to me that the setup was OK and that both subscribers were being executed.
    Then I entered a price change to $12.95, which is divisible by both 3 and 4, and got an error indication as expected. Checking the LOG I found NO entries for $12.95, also as expected.
    Then I entered a price of $32.95 which would cause book_sub1 to fail but let book_sub2 to succeed. I GOT NO WAIT WINDOW to indicate any failure (sub1 did fail), yet there was only 1 new entry in the LOG, written by sub2.
    Then I entered a price of $30.95 so that sub1 would succeed but sub2 would fail. This time I GOT a WAIT window and the LOG had a single record from sub1.

    Now the documentation that I have found on the subject indicates that the order of execution of any subscribers is random and can vary from run to run. While my limited setup seems to execute them in a consistent order, I still have a problem with the "handling" of RETURN VALUES by the COM+ mechanism AND the timing of the return from subscribers and need to know:

    1. When does control return back to the publisher? Is it as soon as any subscriber completes or is it only after the last subscriber completes?

    2. What determines the HRESULT to be returned to the publisher?

    It seems to me that, to be useful, the answers to the above should be:
    1) The publisher regains control once the LAST subscriber has completed.
    2) If ANY of the subscribers returns a HRESULT of FAILed then that will be the HRESULT returned once the last subscriber has completed processing regardless of which subscriber actually had the FAILed HRESULT.

    Does anyone know of ways to control this or, barring that, suggest ways that I can use COM+ events for 'mission-critical' components?

    Thanks again for your patience
    Jim Nelson
  • Reply
    Map
    View

    Click here to load this message in the networking platform