Jobs are defined in the Fabric Studio and can be saved to a project file and be deployed to the Fabric Server. A Job can be a Java function or a simple command.
Go to the Project Tree > LU > Java > Category and right click New Function to display the Function Editor window.
Write the User Job function either from:
//writing into a file;
while (test<5 && !isAborted()){
test=test+1;
sleep(10000);
inSecTime=test*10; // value returned by user job function
FileWriter myWriter = new FileWriter("job_test4.txt",true);
myWriter.write("Test Number: "+ test +"::->" + 10*test + " seconds have passed since ...");
myWriter.close();
}
Set the Function Type to the User Job value in the right panel. Once the job is triggered, the following Java user code writes a line into a new file job_test.txt every second until the counter test reaches the value 5. The output file is located in the Fabric Home directory.
Note that the loop control parameter (variable test) is defined as an input parameter of the User Job function, and that a second variable inSecTime is also defined as an output parameter. As such, its value is recorded in the argument field of the k2_jobs table in the k2system keyspace.
Name and save the function.
Go to the Project Tree > your LU > Jobs.
In the Job table, enter the values pertaining to the Job.
Right-click on the LU in the Project Tree, deploy and check for the file in the Fabric Home directory.
Jobs are defined in the Fabric Studio and can be saved to a project file and be deployed to the Fabric Server. A Job can be a Java function or a simple command.
Go to the Project Tree > LU > Java > Category and right click New Function to display the Function Editor window.
Write the User Job function either from:
//writing into a file;
while (test<5 && !isAborted()){
test=test+1;
sleep(10000);
inSecTime=test*10; // value returned by user job function
FileWriter myWriter = new FileWriter("job_test4.txt",true);
myWriter.write("Test Number: "+ test +"::->" + 10*test + " seconds have passed since ...");
myWriter.close();
}
Set the Function Type to the User Job value in the right panel. Once the job is triggered, the following Java user code writes a line into a new file job_test.txt every second until the counter test reaches the value 5. The output file is located in the Fabric Home directory.
Note that the loop control parameter (variable test) is defined as an input parameter of the User Job function, and that a second variable inSecTime is also defined as an output parameter. As such, its value is recorded in the argument field of the k2_jobs table in the k2system keyspace.
Name and save the function.
Go to the Project Tree > your LU > Jobs.
In the Job table, enter the values pertaining to the Job.
Right-click on the LU in the Project Tree, deploy and check for the file in the Fabric Home directory.