public async Task <Result> SendAsync <TInput>(TInput command) where TInput : IMessage { return(await Execute(command, async() => { var commandQueue = _queueFactory.Get(); var data = new CommandNatsAdapter(command); _connection.Publish(commandQueue.Value, data.Reply, data); _connection.Flush(); return await GetResponse(data.Reply); })); }
public NatsCommandReplyModel Get(CommandNatsAdapter data) { var reply = data.Reply; var cmdType = _typeFactory.Get(data.CommandType); if (cmdType == null) { return(null); } return(new NatsCommandReplyModel(_serializer) { CmdType = cmdType, Reply = reply }); }