Esempio n. 1
0
 public override Task<Filter> CreateFilter(Message request)
 {
     var part = new PartInfo(request);
     log.Info("Create filter for service {0} with partition key {1}",
             request.Headers.To,
             part.ToString());
     return createFilter(part, null);
 }
Esempio n. 2
0
        public override Task <Filter> CreateFilter(Message request)
        {
            var part = new PartInfo(request);

            log.Info("Create filter for service {0} with partition key {1}",
                     request.Headers.To,
                     part.ToString());
            return(createFilter(part, null));
        }
Esempio n. 3
0
        // This method is invoked by the host for every request message received. For every message received we
        // resolve the service address using the To address (service name) and the partition key using FabricClient.
        // The RouterTable is updated with the result.         
        public override Task<Filter> UpdateFilter(Message request, Filter oldfilter)
        {
            // if this is not a retry, then just reuse the existing filter
            if (!request.Headers.To.Equals(Retry))
                return Task.FromResult<Filter>(oldfilter);

            // we need to get an updated filter if client told us to retry
            var part = new PartInfo(request);
            log.Info("Updating filter for service {0} with partition key {1}",
                    request.Headers.To,
                    part.ToString());

            var oldFf = (FabricFilter)oldfilter;
            return createFilter(part, oldFf);
        }
Esempio n. 4
0
        // This method is invoked by the host for every request message received. For every message received we
        // resolve the service address using the To address (service name) and the partition key using FabricClient.
        // The RouterTable is updated with the result.
        public override Task <Filter> UpdateFilter(Message request, Filter oldfilter)
        {
            // if this is not a retry, then just reuse the existing filter
            if (!request.Headers.To.Equals(Retry))
            {
                return(Task.FromResult <Filter>(oldfilter));
            }

            // we need to get an updated filter if client told us to retry
            var part = new PartInfo(request);

            log.Info("Updating filter for service {0} with partition key {1}",
                     request.Headers.To,
                     part.ToString());

            var oldFf = (FabricFilter)oldfilter;

            return(createFilter(part, oldFf));
        }
Esempio n. 5
0
        async Task <ResolvedServicePartition> getRsp(PartInfo part, ResolvedServicePartition prev)
        {
            ResolvedServicePartition rsp = null;

            try
            {
                switch (part.Kind)
                {
                case ServicePartitionKind.Singleton:
                    rsp = await Client.ServiceManager.ResolveServicePartitionAsync(part.Message.Headers.To, prev, this.timeout);

                    break;

                case ServicePartitionKind.Int64Range:
                    rsp = await Client.ServiceManager.ResolveServicePartitionAsync(part.Message.Headers.To, part.RangeKey, prev, this.timeout);

                    break;

                case ServicePartitionKind.Named:
                    rsp = await Client.ServiceManager.ResolveServicePartitionAsync(part.Message.Headers.To, part.NameKey, prev, this.timeout);

                    break;
                }
            }
            catch (AggregateException e)
            {
                log.Error(e, "Resolved for service {0} with partition key {1}. Found no endpoints.",
                          part.Message.Headers.To,
                          part.ToString());
                return(null);
            }

            log.Info("Resolve for service {0} with partition key {1}. Found {2} endpoints.",
                     part.Message.Headers.To,
                     part.KindName,
                     rsp.Endpoints.Count);
            return(rsp);
        }
Esempio n. 6
0
        async Task<ResolvedServicePartition> getRsp(PartInfo part, ResolvedServicePartition prev)
        {
            ResolvedServicePartition rsp = null;

            try
            {               
                switch (part.Kind)
                {
                    case ServicePartitionKind.Singleton:
                        rsp = await Client.ServiceManager.ResolveServicePartitionAsync(part.Message.Headers.To, prev, this.timeout);
                        break;
                    case ServicePartitionKind.Int64Range:
                        rsp = await Client.ServiceManager.ResolveServicePartitionAsync(part.Message.Headers.To, part.RangeKey, prev, this.timeout);
                        break;
                    case ServicePartitionKind.Named:
                        rsp = await Client.ServiceManager.ResolveServicePartitionAsync(part.Message.Headers.To, part.NameKey, prev, this.timeout);
                        break;
                }
            }
            catch (AggregateException e)
            {
                log.Error(e, "Resolved for service {0} with partition key {1}. Found no endpoints.",
                    part.Message.Headers.To,
                    part.ToString());
                return null;
            }

            log.Info("Resolve for service {0} with partition key {1}. Found {2} endpoints.",
                        part.Message.Headers.To,
                        part.KindName,
                        rsp.Endpoints.Count);
            return rsp;
        }