public ActorMessageEnvelope <P> SendMessage <R, P>(string remoteActorType, ActorMessageEnvelope <R> request, TimeSpan timeout) { ActorMessageEnvelope <P> response = default(ActorMessageEnvelope <P>); Action <ActorMessageEnvelope <P> > callback = (r) => { response = r; }; try { ManualResetEvent waiter = new ManualResetEvent(false); _callbacks.Add(request.MessageID, new BlockingCallbackHolder(request.MessageID, waiter, callback)); this.BeginSend(remoteActorType, request.ToBytes(this.Encoder)); if (!waiter.WaitOne(timeout)) { _log.ErrorFormat("Timeout when waiting message [{0}] after {1} seconds.", request.MessageType, timeout.TotalSeconds); } waiter.Reset(); waiter.Dispose(); BlockingCallbackHolder throwAway = null; _callbacks.TryRemove(request.MessageID, out throwAway); } catch (Exception ex) { _log.Error(ex.Message, ex); } return(response); }
public void Send <T>(string remoteActorType, ActorMessageEnvelope <T> message) { BeginSend(remoteActorType, message.ToBytes(this.Encoder)); }
public IAsyncResult BeginSend <T>(string remoteActorType, string remoteActorName, ActorMessageEnvelope <T> message, AsyncCallback callback, object state) { return(BeginSend(remoteActorType, remoteActorName, message.ToBytes(this.Encoder), callback, state)); }
public IAsyncResult BeginSend <T>(ActorIdentity remoteActor, ActorMessageEnvelope <T> message, AsyncCallback callback, object state) { return(BeginSend(remoteActor, message.ToBytes(this.Encoder), callback, state)); }
public void BeginSend <T>(ActorIdentity remoteActor, ActorMessageEnvelope <T> message) { BeginSend(remoteActor, message.ToBytes(this.Encoder)); }
public void BeginBroadcast <T>(string remoteActorType, ActorMessageEnvelope <T> message) { BeginBroadcast(remoteActorType, message.ToBytes(this.Encoder)); }
public void BeginBroadcast <T>(IEnumerable <string> remoteActorTypes, ActorMessageEnvelope <T> message) { BeginBroadcast(remoteActorTypes, message.ToBytes(this.Encoder)); }
public void BeginReply <T>(string channelIdentifier, ActorMessageEnvelope <T> message) { BeginReply(channelIdentifier, message.ToBytes(this.Encoder)); }