Exemplo n.º 1
0
        public async Task <IActionResult> RouteToBackend(string backedName)
        {
            try
            {
                //for the proof of concept Iam considering the backend name as the payload of the request.
                if (!await m_provisionUtility.CheckIfBackendExists(backedName))
                {
                    await m_provisionUtility.ProvisionNewBackend(backedName);

                    return(Ok("Provisioned a backend for this request"));
                }
                return(Ok("Backend for this request is already working "));
            }
            catch (Exception ex)
            {
                return(Ok($"Error : {ex.Message}"));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Get(string clientID, string payload)
        {
            try
            {
                //for the proof of concept Iam considering the backend name as the payload of the request.
                if (!await m_provisionUtility.CheckIfBackendExists(clientID))
                {
                    await m_provisionUtility.ProvisionNewBackend(clientID);
                }
                var logicEngine = m_provisionUtility.GetBackendReference(clientID);
                await logicEngine.AddToProcessingQueueAsync(payload);

                return(Ok("Request has been receieved"));
            }
            catch (Exception ex)
            {
                return(Ok($"Error : {ex.Message}"));
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> RouteToBackend(string backedName)
        {
            try
            {
                if (!await m_provisionUtility.CheckIfBackendExists(backedName))
                {
                    await m_provisionUtility.ProvisionNewBackend(backedName);
                }

                var    backendClient = m_provisionUtility.GetBackendReference(backedName);
                string message       = backendClient.PingBackend().Result;
                return(Ok(message));
            }
            catch (Exception ex)
            {
                return(Ok("Success"));

                throw;
            }
        }