コード例 #1
0
        public IActionResult GetCount()
        {
            var request = new ContactGetCount();

            using (var rpcClient = new ContactRpcClient <ContactGetCount, ContactGetCountResponse>(_connectionFactory, _encoding))
            {
                var response = rpcClient.RemoteCall(request);
                return(Ok(response.Count));
            }
        }
コード例 #2
0
        private ContactGetCountResponse WorkHandler(ContactGetCount request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var count    = _contactRepository.GetCount();
            var response = new ContactGetCountResponse(count)
            {
                CorrelationId = request.CorrelationId
            };

            return(response);
        }