Top
Top
LibraryEASYProcess Reference ManualProcessesServicesBatchJobWorkshopEndBatchJob

EndBatchJob Overview

EndBatchJob is used to manually end a Batch Job. This service takes as input the name of the BatchJob you wish to end. This is not case sensitive. If the specified BatchJob does not exist, an exception is thrown.

 

Batch Jobs are processes that can be scheduled to run. They run outside of user interaction and are not initiated by button clicks or page loads like most processes.

 

When working with batch jobs you may encounter situations where you need to end the batch job after a certain record has been processed. in these situations you can use the EndBatchJob service.

For example, consider a batch process which finds the most ordered items for a logged in account. This batch job process could work by running a query against JDE Order History tables for a list of the most ordered items. This query could return a very long list of items. The process would then loop through the results and ask “Is this item in JDE also order-able on the EASYCommerce portal?”. If yes, the item is added to a list of top items for the account. If no, the process looks at the next result from the JDE query and asks the same question. This could continue for a very long time since the query to JDE has very many results. However, the process could be built to continue this process loop until 10 items have been found. At this point, the EndBatchJob service should be run because the desired records were retrieved.


EndBatchJob Use Examples
EndBatchJob Output Cases
Workshop:BatchJobWorkshop
Service:EndBatchJob
Inputs
Name

Outputs
Ended
Running
WindowsProcessId

EndBatchJob Use Examples

Basic EndBatchJob Use

In this example we have four services, one service starts the batch job, then we check the status to prove the batch job is running, after that we use the EndBatchJob service to end the batch job, and then just to make sure we have successfully ended the batch job we get the status again.

The Inputs for these services are all the same, the name of the batch job we are starting, checking, stopping, and checking again.

 

If we look in the logs, we can see that the StartBatchJob creates the job correctly.

Next, we check the status to confirm it is running.

After this, we End the BatchJob. Notice the WindowsProcessId matches between all the services.

We can look at the output from the second GetStatus service to verify the EndBatchJob was successful and it has stopped.


EndBatchJob Output Cases

Successfully Ending a BatchJob

When successfully ending a BatchJob, it will return the following outputs:

Running

False

Ended

True

WindowsProcessId

[WindowsProcessId]

Failure Ending a BatchJob

If the service were to fail ending the batch job without throwing an exception, if would return the following outputs:

Running

True

Ended

False

WindowsProcessId

[WindowsProcessId]

Ending a BatchJob That Wasn’t Running

If you use the EndBatchJob service to end a Batch Job which was not running, it will return the following outputs:

Running

False

Ended

False

WindowsProcessId

[WindowsProcessId] (from the last time the batch job ran)

Ending a BatchJob That Doesn’t Exist

In this example, the EndBatchJob service was used to stop a batch job which does not exist. This threw an exception, shown below.


Powered by EASYProcess (© 2019 K-Rise Systems, Inc).