public async Task Go() { Data d = new Data(); var mqService = mQServiceContainer.GetService(this); using (var ms = new PooledMemoryStream()) { Serializer.Serialize(ms, d); var data = new MessageInfo() { TypeCode = d.GetType().FullName, BinaryBytes = ms.ToArray() }; ms.Position = 0; ms.SetLength(0); Serializer.Serialize(ms, data); for (int i = 0; i < 2; i++) { await mqService.Result.Publish(ms.ToArray(), Guid.NewGuid().ToString()); Console.WriteLine(i); } } }
protected virtual ValueTask <IMQService> GetMQService() { return(mQServiceContainer.GetService(this)); }