Expand my Community achievements bar.

How to configure OSGI sling jobs to parallel running with custom job consumer.

Avatar

Level 2

Hi All,

 

I am creating a utility to imports assets from FTP to AEm DAm server. For that I have used jobmanager.addJob("TOPICS","HASHMAP"); My job triggering withexact topic info and importing assets into AEM DAM Server.

 

To implement parallel execution of job Do I need to do anything apart from Apache Sling Job Queue configuration? If Yes then how to take care as there is not much documnetation on the Adobe documentation.

 

If any one implemented parallel jobs execution please provide inputs.

 

1. How to implement parallel execution of jobs. how to confirm that jobs executing parallelly by updating Apache Sling job Queue OSGI Configuration in AEM.

2. When Job is trigered it automatically processing JobResults and stopping reqest from there itselft.How to redirect request from JobConsumer to Osgi Service.

 

Thanks,

Aruna

6 Replies

Avatar

Community Advisor

Hi,

You don't need to do anything to configure parallel job execution.

You just have to take care of parallel execution in your business logic, I meant multithreading.



Arun Patidar

Avatar

Level 2

Thanks Arun for the reply. 

 

I need some more details on parallel execution. Multi threading means Java multi threading correct.

Is parallel streams work?

Avatar

Community Advisor
Hi, Yes, you can use java multithreading. The sling jobs run parallel based on time or events etc. Just make sure one 2 same job should not work on 1 item at the same time.


Arun Patidar

Avatar

Level 2

Thans for the inputs.

 

I would like to understand how to configure sling jobs to execute parallelly on some event?

Is there any documentation? Please help me in understanding more about it?

 

Thanks,

Aruna

Avatar

Community Advisor
You need to write an event listener and onEvent method write a logic using thread.


Arun Patidar

Avatar

Community Advisor

Please refer to this documentation, to have better understanding of the Queues: https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html#queue-con...

 

aanchalsikka_0-1699420222358.png

 

 

To assure that they are running in parallel:

  • you would have to register many jobs simultaneously
  • Use different param for each registration to help identify the run.

 


Aanchal Sikka