Comments on: WCF Publish Subscribe– A Full Example: The Service Side Part 2 (Implementation) https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/ Production Grade Technical Solutions | Data Encryption and Public Cloud Expert Sun, 12 Oct 2014 16:05:27 +0000 hourly 1 https://wordpress.org/?v=6.9.4 By: Kavya https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-4421 Sun, 12 Oct 2014 16:05:27 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-4421 Very nice examples. I was however wondering, if you could post an example with iobservable on wcf? would be of great help to understand the technicalities

]]>
By: Anuj Varma https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-1472 Thu, 24 Apr 2014 04:57:52 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-1472 In reply to Alvin.

All I have is a general example of the IObserver and IObservable interfaces. To use them within WCF, I would start with the Service Operation code – and make that class implement the IObservable interface (assuming your WCF service will be the publisher). It would need to implement Subscribe and Remove methods as shown below:

public class MagazineService : IMagazineService, IObservable
{

public IDisposable Subscribe(IObserver observer)
{
if (!observers.Contains(observer))
{
observers.Add(observer);
}

return new RemoveMe(observers, observer);
}

private class RemoveMe : IDisposable
{
private List> observers;
private IObserver
observer;

public RemoveMe(List> observers, IObserver observer)
{
this.observers = observers;
this.observer = observer;
}

public void Dispose()
{
if (observer != null && observers.Contains(observer))
{
observers.Remove(observer);
}
}
}

}

]]>
By: Alvin https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-1471 Thu, 24 Apr 2014 04:30:55 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-1471 Hi, do you have an example of using IObserver and IObserverable with WCF? Thanks.

]]>
By: Seth https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-250 Wed, 06 Feb 2013 19:17:06 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-250 Another problem: The Subscribe method should be “+=” on the line: NewIssueAvailableEvent = newIssueHandler; … Otherwise you can only ever have one subscriber.

]]>
By: Seth https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-249 Wed, 06 Feb 2013 19:15:58 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-249 Problems with this code – PublishMagazine should have this call at the end: NewIssueAvailableEvent(this, eargs);

]]>
By: bocho https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-235 Tue, 27 Nov 2012 17:15:35 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-235 In reply to Zakos.

I am having the same issue, I think it is missing to invoke the event… I’m struggling: How did you solve it?
Thanks

]]>
By: sally https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-227 Mon, 12 Nov 2012 14:01:26 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-227 event is not fired !!!!! client is not recieving anything !!!

]]>
By: Zakos https://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-208 Wed, 08 Aug 2012 13:00:14 +0000 http://www.anujvarma.com/wcf-publish-subscribe-a-full-example-the-service-side-part-2-implementation/#comment-208 PublishMagazine missing something… fire event

]]>