RpicHybridRelay 1.0.0
Additional Details
Use version 1.0.1 to ensure settings are encrypted
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package RpicHybridRelay --version 1.0.0
NuGet\Install-Package RpicHybridRelay -Version 1.0.0
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="RpicHybridRelay" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RpicHybridRelay --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RpicHybridRelay, 1.0.0"
#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 RpicHybridRelay as a Cake Addin #addin nuget:?package=RpicHybridRelay&version=1.0.0 // Install RpicHybridRelay as a Cake Tool #tool nuget:?package=RpicHybridRelay&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Hybrid Relay Contracts
Standardized processor classes for Azure Hybrid Relay using encrypted application settings files and a generic pattern for creating processor classes.
Worker startup for Windows Service:
using System.Diagnostics.CodeAnalysis;
using HybridRelaySettings = Rpic.Common.HybridRelay.HybridRelaySettings;
namespace Sample.HybridRelayListener
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
public Worker(ILogger<Worker> logger)
{
_logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
// Create action controller that will perform an action when called remotely
var processor = new InventoryExportProcessor();
// Encryption seed for protecting the configuration file
const string encryption = "UPD_zPH -@kXd.Zg!xVi7@6XYZK.Z6R";
// Load relay settings
var settings = HybridRelaySettings.Load(encryption);
// Create listener service
var listener = new Rpic.Common.HybridRelay.HybridRelayListener(
processor.Process, // The method that will be called when the listener receives data
settings,
encryption,
_logger);
// Start the service
await listener.Start(); // Start the listener and register a channel to hybrid relay
_logger.LogInformation("Worker started at: {time}", DateTimeOffset.Now);
// Keep running until service stopped
while (!stoppingToken.IsCancellationRequested)
{
await Task.Delay(1000, stoppingToken);
}
// Remove the channel listener registration
await listener.Stop();
_logger.LogInformation("Worker stopped at: {time}", DateTimeOffset.Now);
}
}
}
Settings file:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"HybridRelay": {
"DisplayName": "RPIC Proxy Service",
"Description": "Hybrid relay service listener for publishing data records to RPIC Integration Platform.",
"Namespace": "relay-rpic-lekman-ts",
"Connection": "hrc-template-rpic-ts",
"Key": {
"Value": "Add initial secret here",
"Secret": "Value will be updated once service starts and encrypt to local machine key and entropy"
},
"KeyName": "RootManageSharedAccessKey"
}
}
Implementation of service process:
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Microsoft.Azure.Relay;
using Newtonsoft.Json;
using Rpic.Common.HybridRelay;
namespace Rpic.InventoryLogistics.InventoryExport.HybridRelayListener
{
internal class SampleProcessor : IHybridRelayListenerProcessor
{
internal string Process(Stream stream, ILogger logger)
{
// Add code to call private API
var response = SomeService.Call();
// Return as JSON
return JsonConvert.SerializeObject(response);
}
}
}
Product | Versions 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.
-
net7.0
- Microsoft.Azure.Relay (>= 3.0.1)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Microsoft.Extensions.Configuration.UserSecrets (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Security.Cryptography.ProtectedData (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.