ZayniFramework.Middle.Service.Client 2.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZayniFramework.Middle.Service.Client --version 2.3.2
                    
NuGet\Install-Package ZayniFramework.Middle.Service.Client -Version 2.3.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="ZayniFramework.Middle.Service.Client" Version="2.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZayniFramework.Middle.Service.Client" Version="2.3.2" />
                    
Directory.Packages.props
<PackageReference Include="ZayniFramework.Middle.Service.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZayniFramework.Middle.Service.Client --version 2.3.2
                    
#r "nuget: ZayniFramework.Middle.Service.Client, 2.3.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.
#:package ZayniFramework.Middle.Service.Client@2.3.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZayniFramework.Middle.Service.Client&version=2.3.2
                    
Install as a Cake Addin
#tool nuget:?package=ZayniFramework.Middle.Service.Client&version=2.3.2
                    
Install as a Cake Tool

Middleware Middle.Service.Client module example.

You have define your own business logic service by using Middle.Service module. Now you can use Middle.Service.Client module to send a RPC request, trigger a service event or publish a message to your service action.

First, add a serviceClientConfig.json in your client-side app project.

{
    "serviceClients": [
        {
            "serviceClientName": "PaymentServiceProxy",
            "remoteServiceName": "PaymentService",
            "remoteHostType": "TCPSocket",
            "remoteClient": "GCP-Production",
            "enableActionLogToDB": true
        },
        {
            "serviceClientName": "SomeService",
            "remoteServiceName": "SomeInProcessService",
            
            // This is a in-process proxy. That means the 'SomeInProcessService' is a in-process service in your client side process.
            // You will need to config the serviceHostConfig.json your client side application too!
            "remoteHostType": "InProcess",
            "enableActionLogToDB": true
        }
    ],
    "rabbitMQProtocol": {
        "defaultRemoteClient": "GCP-Production",
        "remoteClients": [
            {
                "name": "GCP-Production",
                "mbHost": "XXX",
                "mbPort": 5672,
                "mbUserId": "XXX",
                "mbPassword": "XXX",
                "mbVHost": "SomeHost",
                "defaultExchange": "Middle.Test.Topic",
                "rpc": {
                    "exchange": "Middle.Test.Topic",
                    "routingKey": "RPC.Server.",
                    "rpcReplyQueue": "Middle.Server.RPC.Res",
                    "rcpResponseTimeout": 5
                },
                "publish": {
                    "exchange": "Middle.Test.Topic",
                    "routingKey": "Event.Client."
                },
                "listen": {
                    "msgQueue": "Middle.Client.ListenServer.Msg",
                    "msgRoutingKey": "Event.Server."
                }
            }
        ]
    },
    "tcpSocketProtocol": {
        "defaultRemoteClient": "GCP-Production",
        "remoteClients": [
            {
                "name": "GCP-Production",
                "tcpServerHost": "XXX",
                "tcpServerPort": 5590,
                "tcpSendBufferSize": 5,
                "tcpReceiveBufferSize": 10,
                "connectionTimeout": 1,
                "tcpResponseTimeout": 5
            }
        ]
    },
    "webSocketProtocol": {
        "defaultRemoteClient": "GCP-Production",
        "remoteClients": [
            {
                "name": "GCP-Production",
                "webSocketHostBaseUrl": "ws://XXX.XXX.XXX.XXX:5580",
                "wsResponseTimeout": 5
            }
        ]
    },
    "gRPCProtocol": {
        "remoteClients": [
            {
                "name": "Azure-Procution",
                "serverHost": "XXX.XXX.XXX.XXX",
                "serverPort": 1155
            }
        ]
    },
    "httpCoreProtocol": {
        "remoteClients": [
            {
                "name": "GCP-Production",
                "httpHostUrl": "http://XXX.XXX.XXX.XXX:5110/action",
                "httpResponseTimeout": 5
            }
        ]
    }
}

Write your ClientProxy class and extends RemoteProxy class.<br/> Add namespace using.

using ZayniFramework.Common;
using ZayniFramework.Middle.Service.Client;

/// <summary>Some client proxy.
/// </summary>
public class PaymentProxy : RemoteProxy

Write your constructor and pass the service client name to base class.

/// <summary>預設建構子
/// </summary>
public PaymentProxy() : base( "PaymentServiceProxy" )
{
}

/// <summary>多載建構子
/// </summary>
/// <param name="path">服務客戶端 serviceClientConfig.json 設定檔的路徑</param>
public PaymentProxy( string path = "./serviceClientConfig.json" ) : base( serviceClientName: "PaymentServiceProxy", configPath: "./serviceClientConfig.json" )
{
}

Then, you can use the RemoteProxy base methods, you can send a RPC request or publish message to your Middle.Service service action.

/// <summary>執行遠端服務動作的測試
/// </summary>
public new Result<TResDTO> Execute<TReqDTO, TResDTO>( string actionName, TReqDTO request ) => base.Execute<TReqDTO, TResDTO>( actionName, request );

/// <summary>發佈 ServiceEvent 服務事件訊息的測試
/// </summary>
public new Result Publish<TMsgDTO>( string actionName, TMsgDTO dto ) => base.Publish<TMsgDTO>( actionName, dto );

You might need to register the extension IRemoteClient type into RemoteClientFactory before you create your RemoteProxy.<br/> If you don't have other extension IRemoteClient, then you won't need to do this.

// Register the 'gRPCRemoteClient' into the RemoteClientFactory. The name is 'gRPC'.
RemoteClientFactory.RegisterRemoteClientType<gRPCRemoteClient>( "gRPC" );

Finally, you can use your own ClientProxy object to send RPC request or publish message.

var paymentProxy = new PaymentProxy( "./serviceClientConfig.json" );

var reqDTO = new SomethingDTO() 
{
    SomeMessage     = "This is a message from masOS or linux.",
    SomeDate        = DateTime.Now,
    SomeMagicNumber = 24.52D,
    LuckyNumber     = 333,
    IsSuperMan      = true
};

// Send a RPC request to the ServiceHost server-side.
var r = paymentProxy.Execute<SomethingDTO, MagicDTO>( "MagicTestAction", reqDTO );

More detail sample code. You can go to Test/ServieHostTest/ServiceHost.Client.ConsoleApp directory to see the complete sample code.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ZayniFramework.Middle.Service.Client:

Package Downloads
ZayniFramework.Middle.Service.Grpc.Client

This is an extension module for Zayni Framework's Middle.Service.Client module. This extension module provide the gRPC RemoteClient implementation for Middle.Service.Client module. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

ZayniFramework.Middle.Service.HttpCore.Client

This is an extension module for Zayni Framework's Middle.Service.Client module. This extension module provide the Http RemoteClient implementation for Middle.Service.Client module. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.142 227 3/19/2024
8.0.141 257 1/4/2024
8.0.140 245 12/17/2023
6.0.138 259 3/19/2024
6.0.137 422 9/20/2023
6.0.136 404 9/14/2023
6.0.135 420 9/10/2023
6.0.134 461 7/12/2023
6.0.133 468 7/10/2023
6.0.132 470 7/7/2023
6.0.131 464 6/19/2023
6.0.130 490 6/19/2023
6.0.129 11,291 7/2/2022
6.0.128 1,349 1/16/2022
6.0.127 1,353 1/15/2022
6.0.126 1,342 1/15/2022
6.0.125 862 1/8/2022
6.0.125-hotfix1 487 1/8/2022
6.0.124 923 1/7/2022
6.0.123 1,058 11/14/2021
5.0.129 1,720 7/2/2022
5.0.128 1,811 1/16/2022
5.0.125 1,004 1/8/2022
5.0.124 999 1/7/2022
5.0.123 1,299 11/14/2021
5.0.122 1,436 10/11/2021
5.0.121 1,434 5/1/2021
3.1.137 725 9/20/2023
3.1.136 666 9/14/2023
3.1.135 682 9/10/2023
3.1.134 751 7/12/2023
3.1.133 777 7/11/2023
3.1.132 727 7/8/2023
3.1.131 711 6/19/2023
3.1.130 1,349 2/1/2023
3.1.129 2,374 7/2/2022
3.1.128 2,601 1/16/2022
3.1.125 1,386 1/8/2022
3.1.124 1,349 1/7/2022
3.1.123 1,757 11/14/2021
3.1.122 1,916 10/11/2021
3.1.121 1,981 5/1/2021
2.31.120 1,404 3/14/2021
2.30.115 4,999 3/6/2021
2.30.114 1,352 3/6/2021
2.20.101 1,858 3/1/2021
2.19.3 1,385 2/11/2021
2.19.2 13,656 2/6/2021
2.19.1 1,625 1/6/2021
2.19.0 1,641 1/1/2021
2.18.3 2,543 12/27/2020
2.18.2 3,205 8/29/2020
2.18.1 6,378 8/26/2020
2.18.0 2,875 8/20/2020
2.17.135 2,494 8/19/2020
2.17.134 2,621 7/28/2020
2.17.133 2,710 7/27/2020
2.17.132 2,480 7/18/2020
2.17.131 2,648 7/11/2020
2.16.130 2,519 6/13/2020
2.15.128 2,691 6/3/2020
2.15.127 2,643 5/31/2020
2.15.126 3,418 4/30/2020
2.14.122 2,406 4/13/2020
2.13.100 2,532 3/12/2020
2.12.51 2,546 2/18/2020
2.11.50 5,623 2/10/2020
2.10.44 6,217 1/30/2020
2.9.43 6,271 1/11/2020
2.8.42 6,345 1/10/2020
2.8.41 6,207 1/5/2020
2.7.40 6,125 1/2/2020
2.7.39 6,112 1/2/2020
2.7.38 6,440 1/1/2020
2.6.37 6,235 12/23/2019
2.6.35 6,698 12/4/2019
2.6.1 6,279 12/2/2019
2.6.0 6,096 11/28/2019
2.5.2 6,498 11/26/2019
2.5.1 6,224 11/12/2019
2.5.0 6,086 11/9/2019
2.4.3 6,573 10/16/2019
2.4.2 6,232 10/16/2019
2.4.1 6,358 9/20/2019
2.3.113 1,377 3/6/2021
2.3.112 1,300 3/6/2021
2.3.28 6,266 9/19/2019
2.3.27 6,341 8/30/2019
2.3.26 6,264 8/20/2019
2.3.25 6,225 8/12/2019
2.3.22 6,173 7/31/2019
2.3.21 6,131 7/20/2019
2.3.20 5,880 6/22/2019
2.3.19 6,340 6/14/2019
2.3.18 6,224 6/13/2019
2.3.17 6,302 6/13/2019
2.3.15 6,115 6/8/2019
2.3.14 6,213 6/8/2019
2.3.13 6,182 5/30/2019
2.3.12 2,749 5/24/2019
2.3.11 2,740 5/24/2019
2.3.10 2,842 5/21/2019
2.3.9 2,696 5/9/2019
2.3.8 2,790 5/8/2019
2.3.7 2,817 4/30/2019
2.3.6 2,946 4/23/2019
2.3.5 2,825 4/19/2019
2.3.4 2,686 4/18/2019
2.3.3 2,755 4/17/2019
2.3.2 2,828 4/6/2019
2.3.1 2,772 12/15/2018
2.3.0 2,890 12/7/2018
2.2.7 1,951 11/30/2018
2.2.6 3,044 11/25/2018
2.2.5 2,170 11/23/2018
2.2.4 2,035 11/22/2018
2.2.3 1,793 11/21/2018
2.2.2 1,821 11/19/2018
2.2.1 2,928 11/17/2018
2.2.0 2,592 11/16/2018
2.1.0 2,557 11/15/2018
2.0.1 1,754 11/6/2018
2.0.0 1,870 11/4/2018