EventBus.NetStandard 1.1.3.1

Simple Event Bus Library for NetStandard. Based on @songdongsheng EventBus

Install-Package EventBus.NetStandard -Version 1.1.3.1
dotnet add package EventBus.NetStandard --version 1.1.3.1
<PackageReference Include="EventBus.NetStandard" Version="1.1.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EventBus.NetStandard --version 1.1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EventBus.NetStandard, 1.1.3.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install EventBus.NetStandard as a Cake Addin
#addin nuget:?package=EventBus.NetStandard&version=1.1.3.1

// Install EventBus.NetStandard as a Cake Tool
#tool nuget:?package=EventBus.NetStandard&version=1.1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Simple Event Bus Library for .NET

Questions & Comments

Any feedback is welcome, please use the Issues on this repository.

Build Status

.NETCoreApp 1.0 .NET Framework 4.6 .NET Framework 4.5

Basic usage

private void SimpleTest()
{
    // OrderedEventBus eventBus = OrderedEventBus.GetDefaultEventBus();
    SimpleEventBus eventBus = SimpleEventBus.GetDefaultEventBus();
    eventBus.Register(this);
    eventBus.Post("msg", TimeSpan.Zero);
    eventBus.Post("xxx", TimeSpan.FromSeconds(2));
    eventBus.Post(new RarEvent("session-01", "ggsn-01"), TimeSpan.FromSeconds(1));
    while(eventBus.PendingEventNumber > 0)
    {
        Thread.Sleep(100);
    }
    eventBus.Deregister(this);
}

[EventSubscriber]
public void HandleEvent(RarEvent rarEvent)
{
    Trace.TraceInformation("Got RAR event: {0}", rarEvent);
}

[EventSubscriber]
public void HandleEvent(string message)
{
    Trace.TraceInformation("Got message event: {0}", message);
}

internal class RarEvent
{
    public RarEvent(string sessionId, string hostId)
    {
        SessionId = sessionId;
        HostId = hostId;
    }

    public RarEvent(string sessionId, string hostId, string peerId)
    {
        SessionId = sessionId;
        HostId = hostId;
        PeerId = peerId;
    }

    public string SessionId { get; }

    public string HostId { get; }

    public string PeerId { get; }

    public override string ToString()
    {
        StringBuilder sb = new StringBuilder(128);
        sb.Append("{sessionId='").AppendFormat(SessionId);
        sb.Append("', hostId='").Append(HostId);
        if (!string.IsNullOrWhiteSpace(PeerId))
        {
            sb.Append("', peerId='").Append(PeerId);
        }
        sb.Append("'}");
        return sb.ToString();
    }
}

Building from source

cd EventBus

dotnet restore
dotnet build -c Release

msbuild EventBus.csproj /t:Rebuild /p:Platform=AnyCPU /p:Configuration=Release
msbuild EventBus.csproj /t:Rebuild /p:Platform=AnyCPU /p:Configuration=Release46
msbuild EventBus.csproj /t:Rebuild /p:Platform=AnyCPU /p:Configuration=Release45

doxygen

nuget pack EventBus.nuspec

Simple Event Bus Library for .NET

Questions & Comments

Any feedback is welcome, please use the Issues on this repository.

Build Status

.NETCoreApp 1.0 .NET Framework 4.6 .NET Framework 4.5

Basic usage

private void SimpleTest()
{
    // OrderedEventBus eventBus = OrderedEventBus.GetDefaultEventBus();
    SimpleEventBus eventBus = SimpleEventBus.GetDefaultEventBus();
    eventBus.Register(this);
    eventBus.Post("msg", TimeSpan.Zero);
    eventBus.Post("xxx", TimeSpan.FromSeconds(2));
    eventBus.Post(new RarEvent("session-01", "ggsn-01"), TimeSpan.FromSeconds(1));
    while(eventBus.PendingEventNumber > 0)
    {
        Thread.Sleep(100);
    }
    eventBus.Deregister(this);
}

[EventSubscriber]
public void HandleEvent(RarEvent rarEvent)
{
    Trace.TraceInformation("Got RAR event: {0}", rarEvent);
}

[EventSubscriber]
public void HandleEvent(string message)
{
    Trace.TraceInformation("Got message event: {0}", message);
}

internal class RarEvent
{
    public RarEvent(string sessionId, string hostId)
    {
        SessionId = sessionId;
        HostId = hostId;
    }

    public RarEvent(string sessionId, string hostId, string peerId)
    {
        SessionId = sessionId;
        HostId = hostId;
        PeerId = peerId;
    }

    public string SessionId { get; }

    public string HostId { get; }

    public string PeerId { get; }

    public override string ToString()
    {
        StringBuilder sb = new StringBuilder(128);
        sb.Append("{sessionId='").AppendFormat(SessionId);
        sb.Append("', hostId='").Append(HostId);
        if (!string.IsNullOrWhiteSpace(PeerId))
        {
            sb.Append("', peerId='").Append(PeerId);
        }
        sb.Append("'}");
        return sb.ToString();
    }
}

Building from source

cd EventBus

dotnet restore
dotnet build -c Release

msbuild EventBus.csproj /t:Rebuild /p:Platform=AnyCPU /p:Configuration=Release
msbuild EventBus.csproj /t:Rebuild /p:Platform=AnyCPU /p:Configuration=Release46
msbuild EventBus.csproj /t:Rebuild /p:Platform=AnyCPU /p:Configuration=Release45

doxygen

nuget pack EventBus.nuspec

Release Notes

Initial NetStandard version. Code from @songdongsheng EventBus v1.1.3

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.3.1 338 3/6/2019