ZayniFramework.Middle.Service.Client
2.3.0
See the version list below for details.
dotnet add package ZayniFramework.Middle.Service.Client --version 2.3.0
NuGet\Install-Package ZayniFramework.Middle.Service.Client -Version 2.3.0
<PackageReference Include="ZayniFramework.Middle.Service.Client" Version="2.3.0" />
paket add ZayniFramework.Middle.Service.Client --version 2.3.0
#r "nuget: ZayniFramework.Middle.Service.Client, 2.3.0"
// Install ZayniFramework.Middle.Service.Client as a Cake Addin #addin nuget:?package=ZayniFramework.Middle.Service.Client&version=2.3.0 // Install ZayniFramework.Middle.Service.Client as a Cake Tool #tool nuget:?package=ZayniFramework.Middle.Service.Client&version=2.3.0
Middleware ServiceHost.Client example.
You have define your own business logic service by using Middle.ServiceHost module. Now you can use Middle.ServiceHost.Client module to request your service action or trigger a service event to 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": "OrderServiceProxy",
"remoteServiceName": "OrderService",
"remoteHostType": "RabbitMQ",
"remoteClient": "GCP-Production",
"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."
}
},
{
"name": "Azure-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
},
{
"name": "Azure-Production",
"tcpServerHost": "XXX",
"tcpServerPort": 5590,
"tcpSendBufferSize": 5,
"tcpReceiveBufferSize": 5,
"connectionTimeout": 2,
"tcpResponseTimeout": 5
}
]
},
"webSocketProtocol": {
"defaultRemoteClient": "GCP-Production",
"remoteClients": [
{
"name": "GCP-Production",
"webSocketHostBaseUrl": "ws://XXX.XXX.XXX.XXX:5580",
"wsResponseTimeout": 5
},
{
"name": "Azure-Production",
"webSocketHostBaseUrl": "ws://XXX.XXX.XXX.XXX:5580",
"wsResponseTimeout": 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" )
{
// pass
}
/// <summary>多載建構子
/// </summary>
/// <param name="path">服務客戶端 serviceClientConfig.json 設定檔的路徑</param>
public PaymentProxy( string path = "./serviceClientConfig.json" ) : base( serviceClientName: "PaymentServiceProxy", configPath: "./serviceClientConfig.json" )
{
// pass
}
Then, you can use the RemoteProxy base methods, you can send a RPC request or publish message to your Middle.ServiceHost 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 );
Finally, you can use your own Client Proxy 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.App directory to see the complete sample code.
Product | Versions 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. |
.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. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 11.0.2)
- RabbitMQ.Client (>= 5.1.0)
- RestSharp (>= 106.3.1)
- websocketsharp.core (>= 1.0.0)
- ZayniFramework.Common (>= 2.3.0)
- ZayniFramework.DataAccess (>= 2.3.0)
- ZayniFramework.Logging (>= 2.3.0)
- ZayniFramework.Middle.Service (>= 2.3.0)
- ZayniFramework.Middle.Service.Entity (>= 2.3.0)
- ZayniFramework.RabbitMQ.Msg.Client (>= 2.3.0)
- ZayniFramework.Serialization (>= 2.3.0)
- ZayniFramework.Validation (>= 2.3.0)
- ZeroFormatter (>= 1.6.4)
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 | 185 | 3/19/2024 |
8.0.141 | 243 | 1/4/2024 |
8.0.140 | 227 | 12/17/2023 |
6.0.138 | 240 | 3/19/2024 |
6.0.137 | 402 | 9/20/2023 |
6.0.136 | 378 | 9/14/2023 |
6.0.135 | 385 | 9/10/2023 |
6.0.134 | 431 | 7/12/2023 |
6.0.133 | 439 | 7/10/2023 |
6.0.132 | 432 | 7/7/2023 |
6.0.131 | 436 | 6/19/2023 |
6.0.130 | 453 | 6/19/2023 |
6.0.129 | 11,244 | 7/2/2022 |
6.0.128 | 1,292 | 1/16/2022 |
6.0.127 | 1,286 | 1/15/2022 |
6.0.126 | 1,284 | 1/15/2022 |
6.0.125 | 806 | 1/8/2022 |
6.0.125-hotfix1 | 434 | 1/8/2022 |
6.0.124 | 859 | 1/7/2022 |
6.0.123 | 999 | 11/14/2021 |
5.0.129 | 1,671 | 7/2/2022 |
5.0.128 | 1,753 | 1/16/2022 |
5.0.125 | 947 | 1/8/2022 |
5.0.124 | 940 | 1/7/2022 |
5.0.123 | 1,239 | 11/14/2021 |
5.0.122 | 1,376 | 10/11/2021 |
5.0.121 | 1,371 | 5/1/2021 |
3.1.137 | 700 | 9/20/2023 |
3.1.136 | 644 | 9/14/2023 |
3.1.135 | 643 | 9/10/2023 |
3.1.134 | 721 | 7/12/2023 |
3.1.133 | 749 | 7/11/2023 |
3.1.132 | 694 | 7/8/2023 |
3.1.131 | 682 | 6/19/2023 |
3.1.130 | 1,310 | 2/1/2023 |
3.1.129 | 2,327 | 7/2/2022 |
3.1.128 | 2,533 | 1/16/2022 |
3.1.125 | 1,329 | 1/8/2022 |
3.1.124 | 1,292 | 1/7/2022 |
3.1.123 | 1,696 | 11/14/2021 |
3.1.122 | 1,855 | 10/11/2021 |
3.1.121 | 1,915 | 5/1/2021 |
2.31.120 | 1,333 | 3/14/2021 |
2.30.115 | 4,929 | 3/6/2021 |
2.30.114 | 1,279 | 3/6/2021 |
2.20.101 | 1,779 | 3/1/2021 |
2.19.3 | 1,312 | 2/11/2021 |
2.19.2 | 13,588 | 2/6/2021 |
2.19.1 | 1,551 | 1/6/2021 |
2.19.0 | 1,566 | 1/1/2021 |
2.18.3 | 2,468 | 12/27/2020 |
2.18.2 | 3,132 | 8/29/2020 |
2.18.1 | 6,304 | 8/26/2020 |
2.18.0 | 2,804 | 8/20/2020 |
2.17.135 | 2,422 | 8/19/2020 |
2.17.134 | 2,549 | 7/28/2020 |
2.17.133 | 2,638 | 7/27/2020 |
2.17.132 | 2,409 | 7/18/2020 |
2.17.131 | 2,576 | 7/11/2020 |
2.16.130 | 2,438 | 6/13/2020 |
2.15.128 | 2,618 | 6/3/2020 |
2.15.127 | 2,563 | 5/31/2020 |
2.15.126 | 3,339 | 4/30/2020 |
2.14.122 | 2,327 | 4/13/2020 |
2.13.100 | 2,452 | 3/12/2020 |
2.12.51 | 2,461 | 2/18/2020 |
2.11.50 | 5,544 | 2/10/2020 |
2.10.44 | 6,131 | 1/30/2020 |
2.9.43 | 6,193 | 1/11/2020 |
2.8.42 | 6,266 | 1/10/2020 |
2.8.41 | 6,129 | 1/5/2020 |
2.7.40 | 6,046 | 1/2/2020 |
2.7.39 | 6,035 | 1/2/2020 |
2.7.38 | 6,364 | 1/1/2020 |
2.6.37 | 6,157 | 12/23/2019 |
2.6.35 | 6,621 | 12/4/2019 |
2.6.1 | 6,203 | 12/2/2019 |
2.6.0 | 6,014 | 11/28/2019 |
2.5.2 | 6,420 | 11/26/2019 |
2.5.1 | 6,145 | 11/12/2019 |
2.5.0 | 6,004 | 11/9/2019 |
2.4.3 | 6,489 | 10/16/2019 |
2.4.2 | 6,153 | 10/16/2019 |
2.4.1 | 6,269 | 9/20/2019 |
2.3.113 | 1,309 | 3/6/2021 |
2.3.112 | 1,235 | 3/6/2021 |
2.3.28 | 6,186 | 9/19/2019 |
2.3.27 | 6,260 | 8/30/2019 |
2.3.26 | 6,181 | 8/20/2019 |
2.3.25 | 6,147 | 8/12/2019 |
2.3.22 | 6,091 | 7/31/2019 |
2.3.21 | 6,049 | 7/20/2019 |
2.3.20 | 5,794 | 6/22/2019 |
2.3.19 | 6,258 | 6/14/2019 |
2.3.18 | 6,139 | 6/13/2019 |
2.3.17 | 6,219 | 6/13/2019 |
2.3.15 | 6,030 | 6/8/2019 |
2.3.14 | 6,133 | 6/8/2019 |
2.3.13 | 6,103 | 5/30/2019 |
2.3.12 | 2,657 | 5/24/2019 |
2.3.11 | 2,658 | 5/24/2019 |
2.3.10 | 2,743 | 5/21/2019 |
2.3.9 | 2,610 | 5/9/2019 |
2.3.8 | 2,707 | 5/8/2019 |
2.3.7 | 2,733 | 4/30/2019 |
2.3.6 | 2,862 | 4/23/2019 |
2.3.5 | 2,742 | 4/19/2019 |
2.3.4 | 2,594 | 4/18/2019 |
2.3.3 | 2,661 | 4/17/2019 |
2.3.2 | 2,745 | 4/6/2019 |
2.3.1 | 2,688 | 12/15/2018 |
2.3.0 | 2,803 | 12/7/2018 |
2.2.7 | 1,851 | 11/30/2018 |
2.2.6 | 2,952 | 11/25/2018 |
2.2.5 | 2,066 | 11/23/2018 |
2.2.4 | 1,943 | 11/22/2018 |
2.2.3 | 1,694 | 11/21/2018 |
2.2.2 | 1,704 | 11/19/2018 |
2.2.1 | 2,831 | 11/17/2018 |
2.2.0 | 2,483 | 11/16/2018 |
2.1.0 | 2,458 | 11/15/2018 |
2.0.1 | 1,657 | 11/6/2018 |
2.0.0 | 1,770 | 11/4/2018 |