Play module to launch methods of your models via TaskQueue
Java Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
conf
lib
src/play/modules/deferer
README.textile
build.xml
commands.py
commands.pyc

README.textile

Deferer

Launch any method of your models via a TaskQueue.

Usage

Model

package models;
import models.deferer.ModelTaskInvoker;

public class MyModel extends Model {

@Id

public Long id;

public static MyModel findById(Long id) {
return Model.all(MyModel.class).filter(“id”, id).get();
}

public void myMethod(String param1, Int param2, etc..) {
// execute some application logic here …
}

public void deferMyMethod(String param1, Int param2, etc..) {
ModelTaskInvoker.defer(“queueName”, “MyModel”, “myMethod”, this.id, param1, param2, etc..);
}

public static void myStaticMethod(String param1, Int param2, etc..) {
// execute some application logic here …
}

public void deferMyStaticMethod(String param1, Int param2, etc..) {
ModelTaskInvoker.deferStatic(“queueName”, “MyModel”, “myMethod”, param1, param2, etc..);
}
}

Your model must have a Long Id and a method to find it by this id.
Your methods must have only simple type parameters.

Route for GAE Task

  • / module:deferer

Configuration

application.deferer.task=GAETask
%test.application.deferer.task=MockTask

possible values : GAETask, PlayTask, MockTask

ModelTaskInvoker.classPrefix = “models.”;
ModelTaskInvoker.findByIdMethodName = “findById”;