bool IActor.OnMessageRecieved <T>(T msg) { EventData eventData = SendBytesToEventHub.BuildMessage <string>(msg); eventHubClient.Send(eventData); return(true); }
public void AddMessage(IActorMessage msg) { try { EventData eventData = SendBytesToEventHub.BuildMessage <MsgType>(msg); EventHubClient.Send(eventData); if (null == msg.Status) { msg.Status = new TaskCompletionSource <IActorMessage>(); } msg.Status?.SetResult(new EventHubMessage(eventData)); } catch (Exception ex) { Exception foundEx = null; var handler = this.FindExceptionHandler(_exceptionTypeToHandler, ex, out foundEx); if (null != handler) { handler.Invoke(foundEx); } if (null != msg.Status && !msg.Status.Task.IsCanceled) { msg.Status.TrySetException(ex); } } }