none
Subscribing to events published from a WCF service RRS feed

  • Question

  • The setup goes as follows.

    I have a WCF service which is listening to events published by TFS. For now, I am just listening to BuildCompletion event.

    I have a library which opens a connection to a database and inserts all the build information. I also have a console application that copies builds.

    Is there any way I can publish an event from the WCF service and subscribe to that event from both my class library and the console application? That way as soon as there is a build available I have all the details of the build for reporting purposes and also can copy the build to probably do some testing.

    I did find an article online at http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S5. This article requires the subscribers to be WCF services though. Is there a way I can subscribe to the events from a Console Application?
    • Edited by warun26 Wednesday, September 25, 2013 8:58 AM
    Wednesday, September 25, 2013 7:39 AM

Answers

  • Hi,

    When read this article:http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S5 , I found the following:

    "You can even define two types of subscribers: transient subscribers are in-memory, running subscribers, and persistent subscribers are subscribers that persist on the disk, representing services to invoke when the event takes place. For transient subscribers you can use the duplex callback mechanism as a handy way of passing the callback reference to the running service. For the persistent subscribers, all you need to record is the subscriber address as reference. When the event is raised, the publishing service will call to the persistent subscriber address and deliver the event. Another important distinction between the two types of subscriptions is that you can store the persistent subscription on the disk or in a database. Doing so will persist the subscription across application shutdowns or machine crashes and restarts, thus enabling administrative configuration of the subscriptions. Obviously, you can't save the transient subscription across an application shutdown and you'll need to set up the transient subscription explicitly every time the application starts."

    So it seems that it is possible about subscribing to the events from a Console Application by using the transient subscribers.

    Best Regards,
    Amy Peng


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by warun26 Friday, September 27, 2013 5:35 AM
    Thursday, September 26, 2013 1:54 AM
    Moderator