-3

I am mainly a low level system developer so I am kind of lost with all those high level tools that Azure offers and all those buzz words.

So here's what I am trying to build: I am building a server that has a processing part (probably using Azure Batch) and a storage part (using storage, duh, and DBs). I would like to hide all of this behind an interface where client applications could:

  • Log in the users

  • Upload/Download selected files

  • Manage their currently running jobs or start some new ones

The client application might be on an iPad,Web browser, PC, ect... New features might arise or change on the server side. This is why would opt for a "server interface" to standardize all clients interactions, but i do not know what Azure tool would fit my needs for this interface. I am not looking for something low level as in building my own protocol and server, just something that would get the job done simply.

Cheers

Léon Cantin

Nuri Tasdemir
  • 9,720
  • 3
  • 42
  • 67

2 Answers2

2

Azure Mobile Services might be a good fit here. The upside is that you can prototype it quickly. In the current portal you can use Mobile Services with either a Node/JavaScript backend or an ASP.NET WebAPI backend. The node option is the fastest/easiest to implement. Some benefits of this approach:

  • The mobile service automatically gets created with a NoSQL-style table (thought it's actually stored in SQL Azure DB under the hood) and exposes REST endpoints for CRUD, along with customizable scripts in JS for each endpoint.
  • Mobile Services has native SDKs for Windows (C# or WinJS), iOS (Obj-C or Swift), Android (Java), and HTML5 (JavaScript) so you can easily connect any of your client apps to it.
  • The mobile service also supports background jobs written in JavaScript. This could be used for your background "processing part", though it's hard to evaluate without more details on what you want to do.
  • You also get built-in support for authentication (Twitter, FB, Google, MSA and AD) + push notifications (WNS, GCM, APNS, etc.)

In the new preview portal, mobile services are replaced by App Services (which includes mobile) but the node backend is not supported yet, hence my recommendation to use Mobile Services instead. You get more control with the ASP.NET WebAPI backend, but you also have to code more of the backend yourself. The advantage is that you can store your data anywhere (storage tables, DocumentDB, SQL DB, etc.)

For the file upload/download, you'd have to use Azure storage blobs, and if your mobile service needs to catalog the files associated to each user, you can simply save the full blob "path" for each file in the Mobile Service table.

The docs for Azure Mobile Services - along with many tutorials - are at http://azure.microsoft.com/en-us/documentation/services/mobile-services/. I also have 3 GitHub repos with sample code for Windows, iOS and Android that integrates with Mobile Services at https://github.com/search?q=user%3AActiveNick+AzureChatr, and a blog post that explains them at http://www.ageofmobility.com/2014/10/06/azurechatr-building-a-cross-platform-chat-app-for-windows-ios-android/.

I hope this helps.

Nick

ActiveNick
  • 551
  • 1
  • 4
  • 12
  • 1
    Thanks for your answer, i actualy condisidered Mobile Apps at some point and found your website. I tried some of the exemples you had but couldn't run them since i don't own Windows 8. It seemed like it had extra features i didn't need and i was lost in everything, plus it seemed that it would only work for mobiles. I am looking for a more generic solution but correct me if i am wrong. I am currently considering the API web app which exposes a REST API and it seemed pretty generic to work on a good range of devices. – Leon Cantin Jul 10 '15 at 16:54
  • 1
    Mobile Services *is* the simplest solution and it exposes a REST API. Forget my samples if you find them too complicated. Just try a basic mobile services tutorial like https://azure.microsoft.com/en-us/documentation/articles/mobile-services-ios-get-started/ for iOS or https://azure.microsoft.com/en-us/documentation/articles/mobile-services-html-get-started/ for web. – ActiveNick Jul 10 '15 at 18:06
  • 1
    Uhm, i guess "simplicity" is subjective because all the extra features that Mobile App adds aren't needed from what i can and only confuse me. Maybe it's because i am more a low level kind of guy. I will settle for Web API which exposes just what i need trough REST calls. It's almost like calling a function where the name is in the link and the data is serialized with a standard inside the body of the HTTP request. It's all i need to make a multiplatform server interface. Maybe i'll consider Mobile App in the future, so thanks! – Leon Cantin Jul 13 '15 at 20:10
0

I ended opting for a Web API which let me "call" functions from the server trough the HTTP protocole. the URL is the "name" of the function and the data are either serialized in body or in the URL. Really simple and flexible, it should work out of the box on any framework that can use HTTP or i might be able to find a library that lets me do it.

My Test code looks like this :

Client:

private async Task SubmitJob()
    {

        JobModel job = new JobModel { ID = 42, name = "HelloJob", completion = 100.0f };

        try
        {
            HttpClient client = new HttpClient();
            HttpResponseMessage response = await client.PostAsJsonAsync<JobModel>("http://localhost:53122/Jobs/Submit", job);
            if (response.IsSuccessStatusCode)
                lblSuccess.Text = "Success!";
            else
                lblSuccess.Text = "Failure!";

        }
        catch (Exception ex)
        {
            string s = ex.ToString();
        }
    }

    private async Task GetJobs()
    {
        try
        {
            HttpClient client = new HttpClient();
            HttpResponseMessage response = await client.GetAsync("http://localhost:53122/Jobs/Info");
            if (response.IsSuccessStatusCode)
            {
               List<JobModel> jobList = await response.Content.ReadAsAsync<List<JobModel>>();
               txtConsole.Text = "";
               foreach(var job in jobList)
               {
                   string line = "ID: " + job.ID + " Name: " + job.name + " completion: " + job.completion + "\r\n";
                   txtConsole.Text += line;
               }
            }
            else
            {
                txtConsole.Text = "Failure!";
            }

        }
        catch (Exception ex)
        {
            string s = ex.ToString();
        }
    }

Server:

        public async Task<IHttpActionResult> GetJobInfo(int jobId)
    {
        try
        {
            JobModel a = new JobModel { name = "jobA", ID = 102, completion = 100.0f };
            JobModel b = new JobModel { name = "jobB", ID = 104, completion = 42.0f };
            JobModel c = new JobModel { name = "jobC", ID = 106, completion = 0.0f };

            List<JobModel> result = new List<JobModel> { a, b, c };
            return Ok(result);
        }
        catch (Exception ex)
        {
            return InternalServerError(ex);
        }
    }

    [HttpPost]
    public async Task<IHttpActionResult> SubmitJob([FromBody] JobModel submitedJob)
    {

        return Ok();
    }