Skip to content

Repository files navigation

Part of the proposed interfaces were implemented between 2020 and 2024 while building an integration with Kubernetes. This project extends their usage to demonstrate a more general approach to managing and integrating them into a software system.

Message-Loop

  1. Overview
  2. Managing Long-Running Operations
  3. Managing Messages
  4. Created With
  5. NuGet

Overview

The application demonstrates a protocol that allows background operations to be managed and custom-frequency message loops to be configured. The Web.Common.dll assembly provides two controllers, each of which works with a single service assigned to it.

In this demo, both services from the Common.dll are registered in a singleton scope. The demo contains a custom topology that is generated from Node.exe by varying environmental variables within a PowerShell 7.0 script. The executables run on different ports and, the protocol binds them together.

The purpose of demo is to show a convenient and minimal web interface for retrieving a complex structure from background jobs across multiple multithreaded services.

To start the demo, execute the following script from the project's root folder.

.\StartAll.ps1

hierarchy

Fig. 1 - Hierarchy of modules.

Custom Topology On Ports

topology

Fig. 2 -

JSON Graph
{
  "status": 5,
  "exception": null,
  "data": {
    "data": "Operation completed on localhost:5000",
    "childResults": [
      {
        "status": 5,
        "exception": null,
        "data": {
          "data": "Operation completed on localhost:5001",
          "childResults": [
            {
              "status": 5,
              "exception": null,
              "data": {
                "data": "Operation completed on localhost:5002",
                "childResults": [
                  {
                    "status": 5,
                    "exception": null,
                    "data": {
                      "data": "Operation completed on localhost:5003",
                      "childResults": []
                    }
                  }
                ]
              }
            },
            {
              "status": 5,
              "exception": null,
              "data": {
                "data": "Operation completed on localhost:5003",
                "childResults": []
              }
            }
          ]
        }
      },
      {
        "status": 5,
        "exception": null,
        "data": {
          "data": "Operation completed on localhost:5002",
          "childResults": [
            {
              "status": 5,
              "exception": null,
              "data": {
                "data": "Operation completed on localhost:5003",
                "childResults": []
              }
            }
          ]
        }
      },
      {
        "status": 5,
        "exception": null,
        "data": {
          "data": "Operation completed on localhost:5003",
          "childResults": []
        }
      }
    ]
  }
}

Fig. 3 - Example of the output produced by a background operation created inside the onNode action. The status field shows the TaskStatus.RanToCompletion value, and the data field contains the actual graph shown in Fig. 2.

Output generated by calling the BuildDataTree extension
{
  "status": 5,
  "exception": null,
  "data": "Operation completed on localhost:5000-->Operation completed on localhost:5001-->Operation completed on localhost:5002-->Operation completed on localhost:5003\r\n"
          "Operation completed on localhost:5000-->Operation completed on localhost:5001-->Operation completed on localhost:5003\r\n"
          "Operation completed on localhost:5000-->Operation completed on localhost:5002-->Operation completed on localhost:5003\r\n"
          "Operation completed on localhost:5000-->Operation completed on localhost:5003\r\n"
}

Fig. 4 - Example of the output produced by returning the result from the onNode action, using the BuildDataTree extension. The output has been formatted to improve readability.

Message-Loop

Managing Long-Running Operations

Polling

Managing Messages

Unicast

Broadcast

Created With

.NET 10.0

ASP.NET Core

Refit

PowerShell 7

Nuget

About

Provides a set of services to build a cancellation engine and start event loops within an application

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages