예제 #1
0
    public CorrelationToken Transmit(IMessage command)
    {
        var token = CorrelationToken.Create();

        messages.Enqueue(stream(command, new Message("", $"echo command {token} completed")));
        return(token);
    }
예제 #2
0
        public CorrelationToken Subscribe(IQueueSubscriber <M> Subscriber)
        {
            var ct = CorrelationToken.Create();

            Subscribers.TryAdd(ct, Subscriber);
            return(ct);
        }
예제 #3
0
        CorrelationToken IQueueReceiver.Subscribe(IQueueSubscriber Subscriber)
        {
            var ct = CorrelationToken.Create();

            Subscribers.TryAdd(ct, Subscriber);
            return(ct);
        }
예제 #4
0
        public Option <CorrelationToken> MonitorPath(FolderPath Path)
        {
            var token = CorrelationToken.Create(Path);

            if (FolderIndex.TryAdd(token, new FolderTree(Path)))
            {
                FolderIndex.TryFind(token)
                .OnNone(Notify)
                .OnSome(tree =>
                {
                    var index = ToMutableIndex(tree);
                    FileIndex.TryAdd(token, index);
                    iter(index.Keys, file => Notify(inform($"Indexed {file}")));
                });
            }

            C.Notify(inform($"{AgentRuntimeId} completed indexing {token}"));
            return(token);
        }
예제 #5
0
 public CorrelatedTextMessage(string Text, CorrelationToken?CT = null)
     : base(CT ?? CorrelationToken.Create())
 {
     this.Text = Text;
 }
예제 #6
0
 protected CorrelatedMessage()
 {
     this.CT = CorrelationToken.Create();
 }