public void SendConfirmationMessageToScheduler(AppointmentConfirmedEvent confirmationEvent) { using (var sqlConnection = new SqlConnection(ConnectionString)) { sqlConnection.Open(); using (var sqlTransaction = sqlConnection.BeginTransaction()) { var conversationHandle = ServiceBrokerWrapper.BeginConversation(sqlTransaction, NotifierService, SchedulerService, Contract); string json = JsonConvert.SerializeObject(confirmationEvent, Formatting.None); ServiceBrokerWrapper.Send(sqlTransaction, conversationHandle, MessageType, ServiceBrokerWrapper.GetBytes(json)); ServiceBrokerWrapper.EndConversation(sqlTransaction, conversationHandle); sqlTransaction.Commit(); } sqlConnection.Close(); } }
public void SendConfirmationMessageToScheduler(AppointmentConfirmedEvent confirmationEvent) { var messageBroker = new MessageBroker(); messageBroker.SendConfirmationMessageToScheduler(confirmationEvent); }