Share
nvents

.NET events across the network

using System;
using Nvents;

namespace NventsSample
{
  class Program
  {
    static void Main(string[] args)
    {
      // subscribe to events
      Events.Subscribe<FooEvent>(
        e => Console.WriteLine(e.Bar));

      // publish events
      Events.Publish(new FooEvent { Bar = "FooBar" });

      Console.ReadLine();
    }
  }

  public class FooEvent
  {
    public string Bar { get; set; }
  }
}

FAQ

How does it work?
A WCF service is started which listens to the first network address on a free TCP port. Subscribers finds these services with WCF Discovery. Events are serialized on publish and sent over the network to subscribers. They are then deserialized, filtred and passed to the subscribe actions.

How to unit test event publishing?
Mock the service used by manipulating the Events.Service property. Note that this property is hidden from intellisense.

How to only use in-process events?
There is an in-process service included. Use it by setting Events.Service = new Nvents.Services.InMemoryService();.

How to explicity set IPAddress and port?
Events.Service = new Nvents.Services.NetworkService(ipaddress, port);.

Are events guranteed?
Events are only published to services that are found when the event is published. There can be network issues at the publishing or subscribing services preventing the event from being raised.

What versions of .NET is supported?
.NET Framework 3.5 and 4.0 (Full or Client Profile), .NET 3.5 support was added in 0.6.

What happens if an execption is thrown in the subcribe action?
The exception will be ignored and the event will be raised on the other subscribers.

How is serialization of events handled?
Events can be any normal class, they are then serialized using NetDataContractSerializer to enable POCO support.

Can it be used commercially?
Yes. A requirement is to include the license, please read the answers on MIT license on stackoverflow.

Download

There is a NuGet package available.

The source code is hosted on github.

News

 

News with RSS feed

Issues

 

Report a new or view all in the nvents issue list

Commits

 

Fork me on GitHub