コード例 #1
0
 public Unit Ask(object message, ProcessId sender, Option <SessionId> sessionId)
 {
     if (userInbox != null)
     {
         ActorInboxCommon.PreProcessMessage <T>(sender, actor.Id, message, sessionId)
         .IfSome(msg =>
         {
             if (IsPaused)
             {
                 new ActorDispatchRemote(ActorContext.System(actor.Id).Ping, actor.Id, cluster, ActorContext.SessionId, false).Ask(message, sender);
             }
             else
             {
                 try
                 {
                     userInbox?.Post(msg);
                 }
                 catch (QueueFullException)
                 {
                     throw new ProcessInboxFullException(actor.Id, MailboxSize, "user");
                 }
             }
         });
     }
     return(unit);
 }
コード例 #2
0
 public Unit Tell(object message, ProcessId sender, Option <SessionId> sessionId)
 {
     if (message == null)
     {
         throw new ArgumentNullException(nameof(message));
     }
     if (userInbox != null)
     {
         ActorInboxCommon.PreProcessMessage <T>(sender, actor.Id, message, sessionId)
         .IfSome(msg =>
         {
             if (IsPaused)
             {
                 new ActorDispatchRemote(ActorContext.System(actor.Id).Ping, actor.Id, cluster, ActorContext.SessionId, false).Tell(message, Schedule.Immediate, sender, Message.TagSpec.User);
             }
             else
             {
                 try
                 {
                     userInbox?.Post(msg);
                 }
                 catch (QueueFullException)
                 {
                     throw new ProcessInboxFullException(actor.Id, MailboxSize, "user");
                 }
             }
         });
     }
     return(unit);
 }
コード例 #3
0
 public Unit Tell(object message, ProcessId sender)
 {
     if (message == null)
     {
         throw new ArgumentNullException(nameof(message));
     }
     if (userInbox != null)
     {
         try
         {
             return(ActorInboxCommon.PreProcessMessage <T>(sender, actor.Id, message).IfSome(msg => userInbox.Post(msg)));
         }
         catch (QueueFullException)
         {
             throw new ProcessInboxFullException(actor.Id, MailboxSize, "user");
         }
     }
     return(unit);
 }