From d6bd5265beca5170bec05398b0e6bc7345f02fda Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Wed, 18 Nov 2020 12:41:02 +0000 Subject: [PATCH] Use JBeret REST API. --- README.md | 11 ++---- .../wow/auctions/resource/BatchResource.java | 39 ------------------- 2 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 batch/src/main/java/com/radcortez/wow/auctions/resource/BatchResource.java diff --git a/README.md b/README.md index 102aea6..9998239 100644 --- a/README.md +++ b/README.md @@ -60,25 +60,22 @@ The Application provides a REST endpoint to call the required batch processes. The `Prepare Batch` is used to retrieve the initial metadata and create the Batch structure to process auction data: ```bash -curl http://localhost:8080/batch/prepare +curl -v -XPOST http://localhost:8080/jobs/prepare-job/start ``` ### Process -The `Process Batch` process the auction data for a set of Realms. Requires the region and the realm id to process: +The `Process Batch` process the auction data for a set of Realms. Requires the region, and the realm id to process: ```bash -curl http://localhost:8080/batch/process/us/11 +curl -v -XPOST -H 'Content-Type:application/json' http://localhost:8080/jobs/process-job/start -d '{"api.blizzard.region":"us","connectedRealmId":11}' ``` This will process the auction data for the Realm `Tichondrius` in the `US` region. It may take a while to finish. After -the processing is done you can check the `AUCTIONSTATISTICS` table in the database. +the processing completes, you can check the `AUCTIONSTATISTICS` table in the database for the statistics data. ## Blog posts ## * [Java EE 7 Batch Processing and World of Warcraft – Part 1](http://www.radcortez.com/java-ee-7-batch-processing-and-world-of-warcraft-part-1) * [Java EE 7 Batch Processing and World of Warcraft – Part 2](http://www.radcortez.com/java-ee-7-batch-processing-and-world-of-warcraft-part-2) - -## How to run ? ## - diff --git a/batch/src/main/java/com/radcortez/wow/auctions/resource/BatchResource.java b/batch/src/main/java/com/radcortez/wow/auctions/resource/BatchResource.java deleted file mode 100644 index e86a920..0000000 --- a/batch/src/main/java/com/radcortez/wow/auctions/resource/BatchResource.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.radcortez.wow.auctions.resource; - -import javax.batch.operations.JobOperator; -import javax.inject.Inject; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Properties; - -@Path("/batch") -@Produces(MediaType.APPLICATION_JSON) -public class BatchResource { - @Inject - JobOperator jobOperator; - - @GET - @Path("/prepare") - public Response prepare() { - long executionId = jobOperator.start("prepare-job", new Properties()); - return Response.ok(executionId).build(); - } - - @GET - @Path("/process/{region}/{connectedRealmId}") - public Response process( - @PathParam("region") final String region, - @PathParam("connectedRealmId") final String connectedRealmId) { - - final Properties jobParameters = new Properties(); - jobParameters.setProperty("api.blizzard.region", region); - jobParameters.setProperty("connectedRealmId", connectedRealmId); - long executionId = jobOperator.start("process-job", jobParameters); - - return Response.ok(executionId).build(); - } -}