Iwate.AzureFunctions.Middlewares.Singleton 1.0.0-preview.2

This is a prerelease version of Iwate.AzureFunctions.Middlewares.Singleton.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Iwate.AzureFunctions.Middlewares.Singleton --version 1.0.0-preview.2                
NuGet\Install-Package Iwate.AzureFunctions.Middlewares.Singleton -Version 1.0.0-preview.2                
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="Iwate.AzureFunctions.Middlewares.Singleton" Version="1.0.0-preview.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Iwate.AzureFunctions.Middlewares.Singleton --version 1.0.0-preview.2                
#r "nuget: Iwate.AzureFunctions.Middlewares.Singleton, 1.0.0-preview.2"                
#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 Iwate.AzureFunctions.Middlewares.Singleton as a Cake Addin
#addin nuget:?package=Iwate.AzureFunctions.Middlewares.Singleton&version=1.0.0-preview.2&prerelease

// Install Iwate.AzureFunctions.Middlewares.Singleton as a Cake Tool
#tool nuget:?package=Iwate.AzureFunctions.Middlewares.Singleton&version=1.0.0-preview.2&prerelease                

NuGet version

A singleton lib for dotnet-isolated of Azure Functions

How to Install

$ dotnet add package Iwate.AzureFunctions.Middlewares.Singleton

How to Use

  1. Register this middleware
var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults(app => {
        app.UseMiddleware<Iwate.AzureFunctions.Middlewares.Singleton.SingletonMiddleware>();
    })
    .Build();
host.Run();
  1. Declare Singleton attribute on your function.
public class SingletonFunction
{
    [Function("SingletonFunction")]
    [Singleton()]
    public async Task RunAsync([QueueTrigger(QUEUE_NAME)]string message)
    {
        ...
    }
}

You can separate a singleton stream to a few lines by partial key if you put the arg on the Singleton attribute.

+-----------------+
|PARTIAL KEY: 100 |
+-------+---------+
        |
+-------v---------+                       +-----------------+
|PARTIAL KEY: 100 |                       |PARTIAL KEY: 101 |
+-------+---------+                       +--------+--------+
        |                                          |
+-------v------------------------------------------v--------+
|                                                           |
|                      Azure Functions                      |
|                                                           |
+-----------------------------------------------------------+
public class SingletonFunction
{
    [Function("SingletonFunction")]
    [Singleton(nameof(Trigger.PartialKey))]
    public async Task RunAsync([QueueTrigger(QUEUE_NAME)]Trigger trigger)
    {
        ...
    }
}
public class Trigger
{
    public string PartialKey { get; set; }
    public string Message { get; set; }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on Iwate.AzureFunctions.Middlewares.Singleton:

Package Downloads
Iwate.AzureFunctions.Middlewares.Commander

A command queuing library for Azure Functions

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-preview.4 144 1/11/2023
1.0.0-preview.3 117 1/6/2023
1.0.0-preview.2 107 12/14/2022
1.0.0-preview.1 102 12/13/2022