Assimalign.Azure.WebJobs.Extensions.EventMediation 1.0.0-pre.1.0.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Assimalign.Azure.WebJobs.Extensions.EventMediation.
dotnet add package Assimalign.Azure.WebJobs.Extensions.EventMediation --version 1.0.0-pre.1.0.1
NuGet\Install-Package Assimalign.Azure.WebJobs.Extensions.EventMediation -Version 1.0.0-pre.1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Assimalign.Azure.WebJobs.Extensions.EventMediation" Version="1.0.0-pre.1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Assimalign.Azure.WebJobs.Extensions.EventMediation --version 1.0.0-pre.1.0.1
#r "nuget: Assimalign.Azure.WebJobs.Extensions.EventMediation, 1.0.0-pre.1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Assimalign.Azure.WebJobs.Extensions.EventMediation as a Cake Addin
#addin nuget:?package=Assimalign.Azure.WebJobs.Extensions.EventMediation&version=1.0.0-pre.1.0.1&prerelease

// Install Assimalign.Azure.WebJobs.Extensions.EventMediation as a Cake Tool
#tool nuget:?package=Assimalign.Azure.WebJobs.Extensions.EventMediation&version=1.0.0-pre.1.0.1&prerelease

Event Mediation Triggers

Event Mediation Triggers for Azure Functions are a solution for listening to in-app asyncchronous events. This is useful when needing to break-up

Use Cases:

Example


// Step 1. Create a context for the use of passing data and other information to the event handlers.
public class SomeContext : IEventContext
{
    public object State { get; set; }
    public object StateChanges { get; set; }
}


// Step 2. Create a Function to emit/notify the occurrence of an event.
//         The Function below will be responsible for notifying the triggers listening for particular event that 
[FunctionName("SomeCoreEventFunction")]
    public async Task<IActionResult> RunCoreEventAsync(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "mediator/trigger")] HttpRequest request,
        [EventMediationBinding("core-event-mediator")] IEventMediator mediator, // Binds the specified mediator. Mediators are injected on the fly.
        ILogger logger)
    {
        try
        {
            // Create your own context and pass whatever data is needed down stream.
            mediator.Notify("core-event-01", new SomeContext());

            return new OkResult();
        }
        catch (Exception exception)
        {
            return new BadRequest();
        }
    }


    /*
        The Triggers listed below will be responsible for carrying out logic for a particular event. 
    
    */
    [FunctionName("CoreEvent_01_Listener")]
    public async Task Run1Async(
        [EventMediationTrigger("core-event-mediator", "core-event-01")] IEventContext context, 
        ILogger logger)
    {
        if (context is SomeContext someContext)
        {
            logger.LogInformation("'test-event-01' was fired for 'test-mediator'.");
        }
    }

    [FunctionName("CoreEvent_02_Listener")]
    public async Task Run2Async(
        [EventMediationTrigger("core-event-mediator", "core-event-02")] IEventContext context,
        ILogger logger)
    {
        logger.LogInformation("'test-event-02' was fired for 'test-mediator'.");
    }

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-pre.1.0.1 134 6/16/2022
1.0.0-pre.1.0.0 117 5/29/2022