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:
the Function Editor window
or
the IntelliJ IDE.
//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.
Jobs can be created also as References regardless of the specific LU. In the Job table, enter the values pertaining to the Job.
Right click the LU in the Project Tree, deploy and then search for the file in the Fabric Home directory.
Go to the Project Tree > Logical Units > LU > Java > src > com > k2view > src > cdbms> usercode> lu and right click New Java File to display the Java Editor window. Name the new file and click Save
Write the User Job function
//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();
}
The BroadwayJob actor provides the ability to trigger a Fabric Job that will in turn execute another Broadway flow once or multiple times depending upon the configuration of the job.
To use this capability, simply select the actor from the Add Actors To Stage menu in the Broadway Flow panel, as illustrated below:
The following parameters are to be filled in the properties tab:
Note that both name and UID can either be chosen by the user, attributed automatically by Fabric, or parsed from a previous actor.
Schedule: the execution frequency of the job, which can be either one of the following:
Affinity: this sets which node/DC name IP address is to be used to run the Broadway job.
Params: This refers to the arguments that can be parsed to the Broadway flow. For example, multiple parameters can be parsed as a key/value object from an external link.
Please refer to this section in order to learn how to setup the schedule type and the affinity appropriately.
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:
the Function Editor window
or
the IntelliJ IDE.
//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.
Jobs can be created also as References regardless of the specific LU. In the Job table, enter the values pertaining to the Job.
Right click the LU in the Project Tree, deploy and then search for the file in the Fabric Home directory.
Go to the Project Tree > Logical Units > LU > Java > src > com > k2view > src > cdbms> usercode> lu and right click New Java File to display the Java Editor window. Name the new file and click Save
Write the User Job function
//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();
}
The BroadwayJob actor provides the ability to trigger a Fabric Job that will in turn execute another Broadway flow once or multiple times depending upon the configuration of the job.
To use this capability, simply select the actor from the Add Actors To Stage menu in the Broadway Flow panel, as illustrated below:
The following parameters are to be filled in the properties tab:
Note that both name and UID can either be chosen by the user, attributed automatically by Fabric, or parsed from a previous actor.
Schedule: the execution frequency of the job, which can be either one of the following:
Affinity: this sets which node/DC name IP address is to be used to run the Broadway job.
Params: This refers to the arguments that can be parsed to the Broadway flow. For example, multiple parameters can be parsed as a key/value object from an external link.
Please refer to this section in order to learn how to setup the schedule type and the affinity appropriately.