Removing IEvent requirement (breaking change)
The IEvent interface has been removed and you can now publish and subscribe to any poco class.
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 // no longer inheriting from IEvent
{
public string Bar { get; set; }
}
}
IPC (inter-process communication) support
Communication on the same machine (without the need for a TCP connection) is now supported via named pipes.
using System;
using Nvents;
using Nvents.Services;
namespace NventsSample
{
class Program
{
static void Main(string[] args)
{
Events.Service = new NamedPipesService(); // can also name the pipe; new NamedPipesService(pipe: "pipe name")
Events.Subscribe<FooEvent>(
e => Console.WriteLine(e.Bar));
Events.Publish(new FooEvent { Bar = "FooBar" });
Console.ReadLine();
}
}
public class FooEvent
{
public string Bar { get; set; }
}
}
Another breaking change is that InProcessService has been renamed to InMemoryService.