//------------------------------------------------------------------------------
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
// CSDN博客:https://blog.csdn.net/qq_40374647
// 哔哩哔哩视频:https://space.bilibili.com/94253567
// Gitee源代码仓库:https://gitee.com/RRQM_Home
// Github源代码仓库:https://github.com/RRQM
// API首页:https://www.yuque.com/rrqm/touchsocket/index
// 交流QQ群:234762506
// 感谢您的下载和使用
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
using System;
using TouchSocket.Core;
namespace TouchSocket.Rpc.TouchRpc
{
///
/// RpcActorGroup
///
public partial class RpcActorGroup
{
#region 委托
///
/// 获取调用函数
///
public Func GetInvokeMethod { get; set; }
///
/// 请求关闭
///
public Action OnClose { get; set; }
///
/// 当文件传输结束之后。并不意味着完成传输,请通过属性值进行判断。
///
public Action OnFileTransfered { get; set; }
///
/// 在文件传输即将进行时触发。
///
public Action OnFileTransfering { get; set; }
///
/// 查找其他RpcActor
///
public Func OnFindRpcActor { get; set; }
///
/// 在完成握手连接时
///
public Action OnHandshaked { get; set; }
///
/// 握手
///
public Action OnHandshaking { get; set; }
///
/// 接收到数据
///
public Action OnReceived { get; set; }
///
/// 需要路由
///
public Action OnRouting { get; set; }
///
/// 流数据处理,用户需要在此事件中对e.Bucket手动释放。
///
public Action OnStreamTransfered { get; set; }
///
/// 即将接收流数据,用户需要在此事件中对e.Bucket初始化。
///
public Action OnStreamTransfering { get; set; }
///
/// 发送数据接口
///
public Action[]> OutputSend { get; set; }
#endregion 委托
///
/// 配置
///
public TouchSocketConfig Config { get; set; }
///
/// RpcStore
///
public RpcStore RpcStore { get; set; }
///
/// 创建RpcActor
///
///
///
public RpcActor CreateRpcActor(object caller)
{
RpcActor rpcActor = new RpcActor(true)
{
FileController = this.Config.Container.GetFileResourceController(),
Logger = Config.Container.Resolve(),
Caller = caller,
RpcStore = RpcStore,
OnHandshaking = OnHandshaking,
GetInvokeMethod = GetInvokeMethod,
OnHandshaked = OnHandshaked,
OutputSend = OutputSend,
OnReceived = OnReceived,
OnClose = OnClose,
OnFindRpcActor = OnFindRpcActor,
OnRouting = OnRouting,
OnStreamTransfering = OnStreamTransfering,
OnStreamTransfered = OnStreamTransfered,
OnFileTransfering = OnFileTransfering,
OnFileTransfered = OnFileTransfered,
RootPath = Config.GetValue(TouchRpcConfigExtensions.RootPathProperty),
SerializationSelector = Config.GetValue(TouchRpcConfigExtensions.SerializationSelectorProperty)
};
return rpcActor;
}
}
}