Hi,
i want to create a task, which running in the background, till someone
stops it.
I found a “demo” at a rabbitmq consumer:
The demo works, but when i try to write my own Task, i cant start it.
(java.lang.NoClassDefFoundError)
I hope someone can help me…
Error:
Start.cfm
<cfscript>
application.stoptasks = false;
//Create Task
myTask = createDynamicProxy(new MyTask(), [ "java.lang.Runnable" ]);
// Create a new start for consuming
thread = createObject( "java", "java.lang.Thread"
).init(myTask).start();
WriteOutput("Started...");
</cfscript>.
MyTask.cfc
component accessors="true"{
property name = "id";
function init(){
variables.id = left( createUUID(), 3);
variables.app = application;
return this;
}
function run(){
while(!variables.app.stopTasks){
WriteOutput("Test Output");
Sleep(1000);
}
}
}
I dont know why this happens…
Thank you!