public async Task PrepareAsync(EventDescriptor descriptor, IDbConnection dbConnection, IDbTransaction dbTransaction) { var message = new Internal.Model.Message { Id = _identityGenerator.NextIdentity(), MessageId = _identityGenerator.NextIdentity(), TransactId = TransactID, Content = descriptor.Message.GetTransferJson(), CreationDate = DateTime.Now, State = MessageState.Processing, Type = MessageType.Published, Exchange = descriptor.Exchange, RouteKey = descriptor.RouteKey }; var metaData = new MetaData(); metaData.Set("ContentType", descriptor.ContentType); metaData.Set("TransactID", message.TransactId.ToString()); metaData.Set("MessageID", message.MessageId.ToString()); metaData.Contact(descriptor.Message.MetaData); message.MetaData = metaData.ToJson(); await _publishedEventPersistenter.InsertAsync(message, dbConnection, dbTransaction); var jsonTransafer = FeiniuBus.Util.FeiniuBusJsonConvert.SerializeObject(new { MetaData = metaData.GetDictionary(), Content = descriptor.Message.Content }); await _messageQueueTransaction.PublishAsync(descriptor.Exchange, descriptor.RouteKey, Encoding.UTF8.GetBytes(jsonTransafer)); }