Creating Jobs for Offloading
Create a client that calls the JobManager.addJob method to create a job that an automatically selected JobConsumer executes. Provide the following information to create the job:
- Topic: The job topic.
- Name: (Optional)
- Properties Map: A
Map<String, Object>object that contains any number of properties, such as the input payload paths and output Payload paths. This Map object is available to the JobConsumer object that executes the job.
The following example service creates a job for a given topic and input payload path.
The log contains the following message when JobGeneratorImpl.createJob is called for the com/adobe/example/offloading topic and the /content/geometrixx/de/services payload:
Developing a Job Consumer
To consume jobs, develop an OSGi service that implements the org.apache.sling.event.jobs.consumer.JobConsumer interface. Identify with the topic to consume using the JobConsumer.PROPERTY_TOPICS property.
The following example JobConsumer implementation registers with the com/adobe/example/offloading topic. The consumer simply sets the Consumed property of the payload content node to true.
The MyJobConsumer class generates the following log messages for an input payload of /content/geometrixx/de/services:
The Consumed property can be observed using CRXDE Lite:
Maven Dependencies
Add the following dependency defenitions to your pom.xml file so that Maven can resolve the Offloading-related classes.
The previous examples also required the following dependency definitions:
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAdobe Experience Manager Roadmap Webinar, Part 1 (Sites & Assets) - Americas & EMEA
Preview the AEM Sites and Assets roadmap and agentic innovations. Ask the team live.
Adobe Experience Manager Roadmap Webinar, Part 1 (Sites & Assets) - Americas & APAC
Preview the AEM Sites and Assets roadmap and agentic innovations. Ask the team live.
Adobe Brand Visibility Roadmap Webinar - Americas & EMEA
Preview the Brand Visibility roadmap across Brand Concierge and AEM Sites. Ask live.