Tuesday, November 13, 2012

App Factory - Consuming APIs in API Manager

This blog shows how your apps can consume APIs hosted in WSO2 API Manager.

Step 1 : Create a API that gives Washington whether details in sandbox and London whether details in the production environment. Lets call this Weather API. Internally it calls the API of www.worldweatheronline.com






Step 2 : Create an application in AppFactory. Lets call it Customer Portal - cportal application. When you create an application in App Factory it will be automatically created in API-M.



Step 3 : Subscribe the application to the Weather API as follows.


Step 4 : Generate keys by clicking on the create dependencies.



Step 5 : Write your application to get keys by calling the CarbonContext and Registry APIs. The correct sandbox and production keys will be used depending on where the application is deployed. Here is the code to do that.

        CarbonContext cCtx = CarbonContext.getCurrentContext();
        Registry registry = (Registry)       cCtx.getRegistry(RegistryType.SYSTEM_GOVERNANCE);
        Resource resource = registry.get("Key");
        if(resource.getContent() instanceof String){
            key = (String) resource.getContent();
        }else{
            key = new String((byte[]) resource.getContent());
        }
Step 6 : Deploy the application to "Development" environment and view results


Step 7 : Promote the application to "Production" environment and view results.


The results of Development environment  differs from Production environment because the keys that is used by the two environments are different. The programmer is unaware about the sandbox and production keys, and everything is handled underneath.

Thursday, November 8, 2012

WSO2 App Factory M7 is released

We finally got M7 out!

You can download the VM from here

Here are the new features of M7.
  • Integrating with Redmine
  • CIO/CEO dashbords
  • BPEL Security
  • Role based security
  • Change the username to email address
  • Dependency Management - API sandboxing
  • Build Status Recording and Gadget
  • Login to Controller to get Logs
  • G-Reg check list items
From this point onwards we are going to try continuous development and deployment of App Factory - at least internally and see how it goes.

Thursday, November 1, 2012

The making of WSO2 App Factory - Storing Artifacts

These days I am thinking a lot about scalability of our deployment setup. Our pre-alpha milestone behavior is to store everything in the file system. So there are two things that should change in the future.

  1. What artifact should we store? How do we identify which artifacts to be stored?
  2. How and where we should we store the artifacts

The ideal answer to the second question is we should store them in the Continuous Integration system itself. Now that is easy!

Now answer to the first question. How to identify which artifacts to store. We are considering many apps with several versions being build many times a day. Simple answer this should be configurable. Some possibilities,

  1. Store the latest build
  2. Store a fixed number of builds 
  3. Store builds for a fixed period
  4. Store the latest builds and the ones that are marked explicitly by the devops/develoeprs

Well ...... there are many many options. But a combination of the 4th and 2nd option would be really interesting.