public void Register() { var connection = new BrokerConnection { EndPoint = KeyVault.GetValue("RABBITMQ_ENDPOINT"), Port = Convert.ToInt32(KeyVault.GetValue("RABBITMQ_PORT")), QueueName = KeyVault.GetValue("RESERVATION_RESPONSE_QUEUENAME"), UserName = "******", Password = "******" }; _messageBroker.ReceiveMessageAsync( connection, actionEvent: NotificationEventsHandler.NotificationReceived ); }
/// <summary> /// Add booking actor method. /// Send a message to theater azure function via service bus. Just for *DEMO* /// Save the booking object in state /// </summary> /// <param name="booking">booking object</param> /// <returns></returns> public async Task AddBooking(Booking booking, CancellationToken cancellationToken) { var connection = new BrokerConnection { EndPoint = KeyVault.GetValue("RABBITMQ_ENDPOINT"), Port = Convert.ToInt32(KeyVault.GetValue("RABBITMQ_PORT")), QueueName = _queueName, UserName = "******", Password = "******" }; try { await this._bookingMessageBroker.SendMessageAsync( connection, booking); await this._bookingRepository.AddBooking(booking); } catch (Exception ex) { throw ex; } }