Esempio n. 1
0
        public async Task <IHttpActionResult> QueryConfiguration(ConsumerConfigureQueryRequest request)
        {
            IConsumerConfigure client = ServiceProxy.Create <IConsumerConfigure>(new Uri("fabric:/Consumer/ConsumerConfigure"), new ServicePartitionKey(0));
            ConsumerConfigureQueryResponseModel result = await client.QueryConfiguration(new ConsumerConfigureQueryRequestModel
            {
                Action        = request.Action,
                AppName       = request.AppName,
                DictionaryKey = request.DictionaryKey
            });

            ConsumerConfigureQueryResponse response = new ConsumerConfigureQueryResponse
            {
                ResultCode = result.ResultCode,
                ResultDesc = result.ResultDesc,
                Configure  = result.Configure.ConvertAll(x => (new ConsumerConfigureResponse
                {
                    Action = x.Action,
                    Address = x.Address.Value,
                    DictionaryKey = x.DictionaryKey,
                    ServiceName = x.ServiceName
                }))
            };

            return(this.Ok(response));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> RegisterConfiguration(ConsumerConfigureRequest request)
        {
            IConsumerConfigure client = ServiceProxy.Create <IConsumerConfigure>(new Uri("fabric:/Consumer/ConsumerConfigure"), new ServicePartitionKey(0));
            bool isSuc = await client.RegisterConfiguration(new ConsumerConfigureRequestModel
            {
                Action        = request.Action,
                Address       = new Url(request.Address),
                ServiceName   = request.ServiceName,
                DictionaryKey = request.DictionaryKey
            });

            return(this.Ok(isSuc));
        }