# Detail on Custom batch

**URL:** <https://forum.camunda.io/t/detail-on-custom-batch/16205>\
**Category:** Community Extensions\
**Tags:** custom-batch, community-extensions\
**Created:** [November 12, 2019, 3:58pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205 "2019-11-12T15:58:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhafsaoui](https://forum.camunda.io/letter_avatar_proxy/v4/letter/n/85f322/32.png) [@nhafsaoui](https://forum.camunda.io/u/nhafsaoui)\
**Post date:** [November 12, 2019, 3:58pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/1 "2019-11-12T15:58:09Z")

</div>

Hello,

I need to set up a batch for my project and we want to use our BPM to do that.

I saw that camunda custom batch extension can do the trick, my only issue is that there is only this link explaining how to use camunda custom batch : [https://github.com/camunda/camunda-bpm-custom-batch/tree/master/extension](https://github.com/camunda/camunda-bpm-custom-batch/tree/master/extension) .

But from my point of view some context is missing because i don’t understand how to implements it.

My goal is to create a cronned BPMN process which will have two tasks : ‘collect datas’ and ‘process datas’. My idea was to use the camunda custom batch extension to ‘process datas’, to do so i wanted to link the service task to a class extending ‘CustomBatchJobHandler’ which will process datas using the execute() method.

First question : is this possible ? Because i assume that the batch need to be created before and then once the batch is created , the datas can be processed . But i don’t know when and where to start the batch and when and where to process my datas?

The batch can be created using this :

```auto
 final Batch batch = CustomBatchBuilder.of(data) #List of Objects which should be processed
        .jobHandler(printStringBatchJobHandler)
        .create();

```

And the datas can be processed using this :

```auto
  @Override
  public void execute(List<String> jobData, CommandContext commandContext) {
      logger.info("Work on data: {}", jobData.get(0));
  }

```

But i don’t know where to create the batch and when datas should be processed. Thanks.

---

<div class="post-metadata">

**Author:** ![nhafsaoui](https://forum.camunda.io/letter_avatar_proxy/v4/letter/n/85f322/32.png) [@nhafsaoui](https://forum.camunda.io/u/nhafsaoui)\
**Post date:** [November 13, 2019, 4:37pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/2 "2019-11-13T16:37:41Z")

</div>

Finally i got my answer thanks to this git repository : [https://github.com/tomconn/camunda-batch-example](https://github.com/tomconn/camunda-batch-example)

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![patrick.wunderlich](https://forum.camunda.io/user_avatar/forum.camunda.io/patrick.wunderlich/32/25104_2.png) [@patrick.wunderlich](https://forum.camunda.io/u/patrick.wunderlich)\
**Post date:** [November 14, 2019, 8:08am UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/3 "2019-11-14T08:08:16Z")

</div>

Hi,

sorry for my late response, if you still have questions, feel free to place it here!

Cheers,  
Patrick

---

<div class="post-metadata">

**Author:** ![nhafsaoui](https://forum.camunda.io/letter_avatar_proxy/v4/letter/n/85f322/32.png) [@nhafsaoui](https://forum.camunda.io/u/nhafsaoui)\
**Post date:** [November 14, 2019, 2:10pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/4 "2019-11-14T14:10:04Z")

</div>

Hi ,

Indeed i have one question , i don’t understand what is the use of jobsPerSeed ? it’s seems like to have no effect on my batch . When using invocationsPerBatchJob , suppose i set 5 for a set of 15 datas , then the batch will create 3 jobs processing 5 datas among the 15. So i’m confused with the use of this parameter because i thought it was used to set the number of job to create but it’s seems like it’s not the case. Thanks.

---

<div class="post-metadata">

**Author:** ![patrick.wunderlich](https://forum.camunda.io/user_avatar/forum.camunda.io/patrick.wunderlich/32/25104_2.png) [@patrick.wunderlich](https://forum.camunda.io/u/patrick.wunderlich)\
**Post date:** [November 14, 2019, 2:27pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/5 "2019-11-14T14:27:10Z")

</div>

Hi,

jobsPerSeed is important if working on a huge amount of date. In your example it doesn’t matter, because default is 10. Lets assume you have an amount of 500 data entries. When the batch “starts”, the seed job will create 10 job where each job works on 5 data entries. If those jobs are finished, the seed job again starts to create 10 new jobs which are again working on 5 data entires per job. So the seed job will run 10 times, and each time it creates 10 jobs.

So if you have a really huge amount, you could e.g. increase jobsPerSeed to 100. But remember that then also your job executer have a lot of work to do and it could be that e.g. timer jobs are not triggered in time. But there are some possibilities to handle such a case by configuring the job executer:  
[https://docs.camunda.org/manual/latest/user-guide/process-engine/the-job-executor/#the-job-order-of-job-acquisition](https://docs.camunda.org/manual/latest/user-guide/process-engine/the-job-executor/#the-job-order-of-job-acquisition)

---

<div class="post-metadata">

**Author:** ![nhafsaoui](https://forum.camunda.io/letter_avatar_proxy/v4/letter/n/85f322/32.png) [@nhafsaoui](https://forum.camunda.io/u/nhafsaoui)\
**Post date:** [November 15, 2019, 4:02pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/6 "2019-11-15T16:02:26Z")

</div>

Thanks you very much it’s clear 🙂 .

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 30, 2024, 12:02pm UTC](https://forum.camunda.io/t/detail-on-custom-batch/16205/7 "2024-01-30T12:02:14Z")

</div>

Closed on January 30, 2024, 12:02pm UTC


