public void Send(string id, T message) { var node = Mailboxes .ReadOrWrite(id, () => Root.Add(id, () => RemoveMailboxFromDictionary(id))); node.Mailbox.Write(message); }
public void Setup(BenchmarkContext context) { _system = ActorSystem.Create($"GetMailboxTypeSpec{Counter.GetAndIncrement()}"); _messageDispatcher = _system.Dispatchers.Lookup(EchoActor.Props.Dispatcher); _mailboxes = new Mailboxes(_system); _createActorThroughput = context.GetCounter(CreateThroughputCounter); }
internal IActor CreateChildActor(Type actorType, IActor parent) { var actor = (Actor)Activator.CreateInstance(actorType); actor.Parent = parent; actor.System = this; Mailboxes.Add(actor, actor.Mailbox); return(actor); }
public List<Mailbox> Get(Mailboxes request) { var mailboxes = Directory.GetDirectories(this.Config.MailFolder).Select(m => { string name = new DirectoryInfo(m).Name; return new Mailbox() { Name = name, Links = new List<Link>(new[] { this.GetMailboxLink(name) }) }; }).ToList(); return mailboxes; }
/// <summary> /// Adds a new mailbox to the user. /// The firstly added Mailbox will be the default one. /// </summary> /// <param name="properties">MailBoxProperties struct with the necessary data to initialize a new mailbox</param> public Mailbox AddMailbox(MailBoxProperties properties) { var newMailbox = new Mailbox(properties); Mailboxes.Add(newMailbox); if (Mailboxes.Count == 1) { CurrentMailbox = newMailbox; } return(newMailbox); }
private void init(int port) { lock (this) { if (!initDone) { connections = new Dictionary <String, OtpCookedConnection>(); sched = new OtpActorSched(); mboxes = new Mailboxes(this, sched); acceptor = new Acceptor(this, port); initDone = true; } } }
private void init(bool acceptConnections, int port) { lock (this) { if (!initDone) { connections = new System.Collections.Hashtable(17, (float)0.95); mboxes = new Mailboxes(this); if (acceptConnections) { acceptor = new Acceptor(this, port); } listenPort = port; initDone = true; } } }
private void ConfigureMailboxes() { _mailboxes = new Mailboxes(this); }
private void init(int port) { lock (this) { if (!initDone) { connections = new Dictionary<String, OtpCookedConnection>(); sched = new OtpActorSched(); mboxes = new Mailboxes(this, sched); acceptor = new Acceptor(this, port); initDone = true; } } }
/// <summary> /// Establish the connection /// </summary> /// <returns></returns> async private System.Threading.Tasks.Task RunAsync() { _traceListener = new ClassTraceListener(); IsDisposed = false; EwsToken = await EWSConstants.AcquireTokenAsync(); Messenger = new MessageManager(CancellationTokenSource); ServiceCredentials = new OAuthCredentials(EwsToken.AccessToken); _reconnect = true; _groups = new Dictionary <string, GroupInfo>(); _mailboxes = new Mailboxes(ServiceCredentials, _traceListener); _subscriptions = new List <SubscriptionCollection>(); _connections = new Dictionary <string, StreamingSubscriptionConnection>(); var impersonationId = EWSConstants.Config.Exchange.ImpersonationAcct; try { var list = new List <EWSFolderInfo>(); using (EWSDbContext context = new EWSDbContext(EWSConstants.Config.Database)) { foreach (var room in context.RoomListRoomEntities.Where(w => !string.IsNullOrEmpty(w.Identity))) { var mailboxId = room.SmtpAddress; try { var roomService = new EWService(EwsToken); roomService.SetImpersonation(ConnectingIdType.SmtpAddress, mailboxId); var folderId = new FolderId(WellKnownFolderName.Calendar, mailboxId); var info = new EWSFolderInfo() { SmtpAddress = mailboxId, Service = roomService, Folder = folderId }; list.Add(info); } catch (Exception srex) { _traceListener.Trace("SyncProgram", $"Failed to ProcessChanges{srex.Message}"); throw new Exception($"ProcessChanges for {mailboxId} with MSG:{srex.Message}"); } } } // Parallel ForEach (on RoomMailbox Grouping and SyncFolders) await System.Threading.Tasks.Task.Run(() => { ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = maxConcurrency }; // Fireoff folder sync in background thread Parallel.ForEach(list, options, (bodyInfo) => { ProcessChanges(bodyInfo); }); }); var tasks = new List <System.Threading.Tasks.Task>(); if (EWSConstants.Config.Exchange.PullEnabled) { // Upon completion tick repeater to poll subscriptions tasks.Add(PullSubscriptionChangesAsync(impersonationId)); } else { // Upon completion kick of streamingsubscription tasks.Add(CreateStreamingSubscriptionGroupingAsync(impersonationId)); } System.Threading.Tasks.Task.WaitAll(tasks.ToArray()); } catch (Exception ex) { Trace.TraceError(ex.Message); } }
private void init(bool acceptConnections, int port) { lock(this) { if (!initDone) { connections = new System.Collections.Hashtable(17, (float) 0.95); mboxes = new Mailboxes(this); if (acceptConnections) acceptor = new Acceptor(this, port); listenPort = port; initDone = true; } } }
private void OnShowUnsubscribedMailboxes(object obj) { IsManagingMailboxes = true; Mailboxes.ForEach(x => x.IsEditing = true); IsExpanded = true; }
private void OnHideUnsubscribedMailboxes(object obj) { IsManagingMailboxes = false; Mailboxes.ForEach(x => x.IsEditing = false); }
public void RemoveMailboxFromDictionary(string id) { Mailboxes.Remove(id); }
/// <summary> /// Deletes the current mailbox /// </summary> public void DeleteMailbox() { CurrentMailbox.Control.StopGettingEmails(); Mailboxes.Remove(CurrentMailbox); CurrentMailbox = null; }