public RpcBindV4_BehaviorTest(string protocolType) { if(protocolType == "TCP") _conn = RpcClient.FromTcp(Env.PortMapper); else _conn = RpcClient.FromUdp(Env.PortMapper); }
public void init() { try { IRpcFactory rpcFactory = new RpcFactory(); RpcObj = rpcFactory.CreateClient<ILeiloeiro>(); TcpMessagingSystemFactory aMessaging = new TcpMessagingSystemFactory(); IDuplexOutputChannel anOutputChannel = aMessaging.CreateDuplexOutputChannel("tcp://" + IP + ":" + Porta + "/");//ip local e porta do servidor RpcObj.AttachDuplexOutputChannel(anOutputChannel); } catch (Exception ex) { throw new Exception("Erro: É necessario iniciar o servidor - " + ex.Message); } }
private IRpcClient<ILeiloeiro> myRpcClient; //declara o Rpc client #endregion Fields #region Constructors public Form1() { InitializeComponent(); tbIP.Text = "127.0.0.1"; tbPorta.Text = "38445"; IRpcFactory anRpcFactory = new RpcFactory(); myRpcClient = anRpcFactory.CreateClient<ILeiloeiro>(); txtCliente.Enabled = false; txtCod.Enabled = false; txtValor.Enabled = false; SumButton.Enabled = false; button1.Enabled = false; ResultLabel.Text = ""; label5.Text = ""; }
public static T GetService <T>(this IRpcClient rpcClient) where T : class { return(rpcClient.GetService <T>(null, rpcClient.DefaultTimeout)); }
/// <summary> /// RPCBIND Version 4 /// /// RPCBIND is contacted by way of an assigned address specific to the transport being used. /// For TCP/IP and UDP/IP, for example, it is port number 111. Each transport has such an assigned, well-known address. /// http://tools.ietf.org/html/rfc1833#section-2.2.1 /// </summary> /// <param name="conn">instance of connector</param> /// <param name="token">cancellation token</param> /// <param name="attachedToParent">attache created task to parent task</param> public RpcBindV4(IRpcClient conn, CancellationToken token, bool attachedToParent) : base(conn, token, attachedToParent) { }
public XbmcServerClient(IRpcClient client) { _client = client; }
/// <summary> /// RPCBIND Version 3 /// /// RPCBIND is contacted by way of an assigned address specific to the transport being used. /// For TCP/IP and UDP/IP, for example, it is port number 111. Each transport has such an assigned, well-known address. /// http://tools.ietf.org/html/rfc1833#section-2.2.1 /// </summary> public static RpcBindV3 RpcBindV3(this IRpcClient conn, CancellationToken token, bool attachedToParent = false) { return(new RpcBindV3(conn, token, attachedToParent)); }
/// <summary> /// RPCBIND Version 4 /// /// RPCBIND is contacted by way of an assigned address specific to the transport being used. /// For TCP/IP and UDP/IP, for example, it is port number 111. Each transport has such an assigned, well-known address. /// http://tools.ietf.org/html/rfc1833#section-2.2.1 /// </summary> public static RpcBindV4 RpcBindV4(this IRpcClient conn, bool attachedToParent = false) { return(new RpcBindV4(conn, CancellationToken.None, attachedToParent)); }
public RpcClientComponentContainer(IRpcClient client, RpcClientComponentOverrides overrides) { this.client = client; this.overrides = overrides; }
/// <summary> /// The portmapper program currently supports two protocols (UDP and TCP). The portmapper is contacted by talking to it on assigned port /// number 111 (SUNRPC) on either of these protocols. /// http://tools.ietf.org/html/rfc1833#section-3.2 /// </summary> public static PortMapper PortMapper(this IRpcClient conn, bool attachedToParent = false) { return(new PortMapper(conn, CancellationToken.None, attachedToParent)); }
/// <summary> /// 调用 /// </summary> /// <param name="method">方法</param> /// <param name="message">消息</param> /// <returns>返回数据</returns> public object Call(MethodInfo method, object message) { var assemblyName = method.DeclaringType.Assembly.GetName().Name; var configInfo = rabbitConfigReader.Reader(); if (configInfo == null) { throw new Exception("找不到RabbitConfig配置信息"); } RpcClientAssemblyWrapInfo rpcClientAssemblyWrap; var messQueueInfo = GetMessageQueueByAssemblyName(configInfo, assemblyName, out rpcClientAssemblyWrap); if (rpcClientAssemblyWrap == null) { throw new Exception($"找不到程序集[{assemblyName}]的RPC客户端配置信息"); } var byteSeri = GetByteSerialization(rpcClientAssemblyWrap.RpcClientAssembly.DataType); var byteData = byteSeri.Serialize(message); IRpcClient rpcClient = null; if (dicVirtualPathMapRpcClient.ContainsKey(rpcClientAssemblyWrap.RabbitVirtualPath.VirtualPath)) { rpcClient = dicVirtualPathMapRpcClient[rpcClientAssemblyWrap.RabbitVirtualPath.VirtualPath]; } else { lock (syncDicVirtualPathMapRpcClient) { IMessageQueueConnection conn = null; // 如果连接配置信息不全,则找默认的连接对象 if (string.IsNullOrWhiteSpace(rpcClientAssemblyWrap.RabbitVirtualPath.ConnectionString) && string.IsNullOrWhiteSpace(rpcClientAssemblyWrap.RabbitVirtualPath.ConnectionStringAppConfigName)) { conn = SingleConnectionTool.CreateConnection(); } else { conn = connectionFactoy.CreateAndOpen(new ConnectionWrapInfo() { ConnectionString = rpcClientAssemblyWrap.RabbitVirtualPath.ConnectionString, ConnectionStringAppConfigName = rpcClientAssemblyWrap.RabbitVirtualPath.ConnectionStringAppConfigName }); } connections.Add(conn); rpcClient = conn.CreateRpcClient(messQueueInfo); try { dicVirtualPathMapRpcClient.Add(rpcClientAssemblyWrap.RabbitVirtualPath.VirtualPath, rpcClient); } catch (ArgumentException) { } } } var reData = rpcClient.Call(byteData); // 如果返回值是空或者类型是void,则直接返回null if (reData.IsNullOrLength0() || method.ReturnType.IsTypeVoid()) { return(null); } else { Type targetType = null; // 判断返回类型是否Task if (method.ReturnType.IsTypeNotGenericityTask()) { return(null); } else if (method.ReturnType.IsTypeGenericityTask()) { targetType = method.ReturnType.GetProperty("Result").PropertyType; } else { targetType = method.ReturnType; } return(byteSeri.Deserialize(reData, targetType)); } }
public OmvDiskMgmtClient(IRpcClient client) : base(client) { ServiceName = "DiskMgmt"; }
public void Setup() { Rabbit.Initialize(); _rpcClient = new RpcClient( new MessageFormatter(new Utf8MessageSerializer(null), new JsonMessageStringifier(null), null), ComponentLocator.Current.Get<IModel>(), null); var model = ComponentLocator.Current.Get<IModel>(); model.QueueDeclare("Rpc_Test_Queue_2_2_2", false, false, true, null); model.ExchangeDeclare("Rcp_Test_Exchange_2_2_2", "direct", false); model.QueueBind("Rpc_Test_Queue_2_2_2", "Rcp_Test_Exchange_2_2_2", "abc"); _serverThread = new Thread(StartRpcServer); _serverThread.Start(); }
public CallContextTestClient(IRpcClient <AmpMessage> client) : base(client) { }
public AmpCallInvoker(IRpcClient <AmpMessage> client) : base(client) { }
public AuthServiceClient(IRpcClient <AmpMessage> client) : base(client) { }
public static T GetService <T>(this IRpcClient rpcClient, string scope) where T : class { return(rpcClient.GetService <T>(scope, rpcClient.DefaultTimeout)); }
public OmvLogFileClient(IRpcClient client) : base(client) { ServiceName = "LogFile"; }
public DirectCardPaymentService(IRpcClient rpcClient) { this.rpcClient = rpcClient; }
public OmvServicesClient(IRpcClient client) : base(client) { ServiceName = "Services"; }
public OmvConfigClient(IRpcClient client) : base(client) { ServiceName = "Config"; }
public StatisticServiceClient(IRpcClient <AmpMessage> client) : base(client) { }