otm:ordering_of_messages:fifo

This is an old revision of the document!


Every day, mashup applications are more present. These applications are created with requests to several servers. Developers have to overcome the issue of creating wrong page due to an unexpected order of executions of responses. For instance, consider a website that creates a web page from two requests (see below web page). If the second response is executed before the first response, the web page is created incorrectly. Instead, the if the first response is executed before the second response, the web page is created correctly. The use of the Fifo strategy can ensure the web page is always created correctly.

When the “activate order” button is clicked, the web page always is created correctly. When the “deactivate order” button is clicked, the web page can be created incorrectly.

Toggle between the code and example

The Fifo strategy is implemented as a TM advice, which a JavaScript function, that is executed every time a response is retrieved:

var fifo = function(jp){  //jp represents the execution of a response 
    if(this.isEarly(jp)){  
        this.queue.push(jp);
    }
    else{
        jp.proceed();
        this.updateCr(jp);
        this.queue.executeEarlyJPs();
    }
};

Go back the the parent page web page.

  • otm/ordering_of_messages/fifo.1294690229.txt.gz
  • Last modified: 2011/01/10 16:10
  • by aspectscript