public void ProcessMessage(ISendSMSCommand command, string connectionAddress) { var mmsPayLoad = (SendMMSCommand)command; if (command == null) { throw new ApplicationException("Unsupported command message."); } Console.WriteLine($"Provider AcmeMMSPlugin sends -> {mmsPayLoad.Text} to {mmsPayLoad.To} with MMS Payload of Length {mmsPayLoad.MMSPayload.Length}"); Domain.Events.NotificationPublisher.DispatchConfirmationMessage(mmsPayLoad.ProviderId, mmsPayLoad.CorrellationId, connectionAddress); }
public void ProcessMessage(ISendSMSCommand command, string connectionAddress) { Console.WriteLine($"MTN PROVIDER ---> send {command.Text} to {command.To}"); try { var result = _messager.Post <MTNMessage, int>("http://localhost:50508/sendsms", new MTNMessage() { ApiKey = Guid.NewGuid().ToString(), Text = command.Text, To = command.To }).Result; } catch (Exception ex) { throw; } NotificationPublisher.DispatchConfirmationMessage(command.ProviderId, command.CorrellationId, connectionAddress); }
static void HandleSMSCommand(ISendSMSCommand message) { var provider = _manager.ProviderContainer[(int)message.ProviderId]; if (provider == null) { throw new ApplicationException("Unsupported message provider id."); } Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Received by Subscriber with Id: {SubscriberID}. Message was {message.Text}"); Console.ResetColor(); try { provider.ProcessMessage(message, CONNECTION_ADDRESS); } catch (Exception ex) { //log the exception. if you throw it will go into a global error queue. //so thnk about putting it back into the originating queue //throw; } }
public void ProcessMessage(ISendSMSCommand command, string connectionAddress) { Console.WriteLine($"Provider Vodacom sends -> {command.Text} to {command.To}"); Domain.Events.NotificationPublisher.DispatchConfirmationMessage(command.ProviderId, command.CorrellationId, connectionAddress); }