public static IRpcClient <AmpMessage> Create(string remoteAddress, int multiplexCount = 1) { var client = new RpcClientBuilder() .AddCore <AmpMessage>() .UseSetting("MultiplexCount", multiplexCount.ToString()) .UserNettyClient <AmpMessage>() .ConfigureServices((services) => { services.AddSingleton <IMessageCodecs <AmpMessage>, AmpCodecs>(); }) .UseServer(remoteAddress) .Build <AmpMessage>(); return(client); }
public async Task <ITopologyManager> CreateTopologyManager(CancellationToken cancellationToken = default) { try { var session = await CreateSession(cancellationToken).ConfigureAwait(false); var rpcClientBuilder = new RpcClientBuilder(session); var rpcClient = await rpcClientBuilder.CreateAsync("activemq.management", cancellationToken).ConfigureAwait(false); return(new TopologyManager(rpcClient)); } catch (Exception e) { throw new CreateTopologyManagerException("Failed to create TopologyManager.", e); } }
async static void run() { var client = new RpcClientBuilder().ConfigAdress("127.0.0.1", 10336) .ConfigUser("001", "001") .Build(); await client.Connect(); while (true) { var response = client.Call <string>("/test/say?what=haha"); Console.WriteLine(response); Thread.Sleep(200); } }