Expand my Community achievements bar.

SOLVED

Programmatically invoke DAM Offloading with custom workflow

Avatar

Level 5

I'm trying to programmatically invoke a workflow which holds two workflows - DAM Offloading & a custom workflow

The problem I have here is Offloading is working fine...however my custom workflow is not executing within the step.

Currently offloading has two servers - Both don't have my custom workflow model nor the oSGI bundles which holds the step.

What is the correct way to go about this.

Note: If I make a workflow launcher with custom workflow to execute on node created - Then the offloading & custom workflow execute. I need this code wise.

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi

As mentioned by Scott, You can refer to the article "Invoking Adobe Experience Manager Workflows using the AEM Java API".

You can also achieve it by creating Custom AEM Workflow step, and that step can then use AEM Java API for AEM workflows.

Link1:- https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html

Link2:- https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

Run Workflow programmatically  :- http://stackoverflow.com/questions/15233798/cq5-programmatically-run-a-workflow

//WorkflowService wfService;

WorkflowSession wfSession = wfService.getWorkflowSession(jcrSession);

WorkflowModel model = wfSession.getModel("/etc/workflow/models/x/jcr:content/model");

WorkflowData data = wfSession.newWorkflowData("JCR_PATH", payloadPath);

Workflow workflow = wfSession.startWorkflow(model, data);

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

7 Replies

Avatar

Level 10

Are you saying that both the workflow executes if you use launcher and not using programatically ??

If so are you seeing any error in the logs after the execution of offloading workflow ? or anywhere when you are calling this workflow programatically ?

Avatar

Level 5

bsloki wrote...

Are you saying that both the workflow executes if you use launcher and not using programatically ??

If so are you seeing any error in the logs after the execution of offloading workflow ? or anywhere when you are calling this workflow programatically ?

 


That is correct!

Workflow Model A (What I'm programmatically invoking)

Step A - DAM Offloading

Step B - My Custom Workflow

 

If I run this it's showing up as complete but nothing is actually getting processed!

No errors across all three servers that I have noticed.

Avatar

Correct answer by
Administrator

Hi

As mentioned by Scott, You can refer to the article "Invoking Adobe Experience Manager Workflows using the AEM Java API".

You can also achieve it by creating Custom AEM Workflow step, and that step can then use AEM Java API for AEM workflows.

Link1:- https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html

Link2:- https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

Run Workflow programmatically  :- http://stackoverflow.com/questions/15233798/cq5-programmatically-run-a-workflow

//WorkflowService wfService;

WorkflowSession wfSession = wfService.getWorkflowSession(jcrSession);

WorkflowModel model = wfSession.getModel("/etc/workflow/models/x/jcr:content/model");

WorkflowData data = wfSession.newWorkflowData("JCR_PATH", payloadPath);

Workflow workflow = wfSession.startWorkflow(model, data);

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 9

Hi TheBigRed,

May I know what is the use case which requires you to write a piece of code for running workflows?. Personally, I don't think, coding should be the last option. We may have to explore it.

"Writing a code isn't tough, But, tough to maintain it ".

Jitendra

Avatar

Level 5

kautuksahni wrote...

Hi

As mentioned by Scott, You can refer to the article "Invoking Adobe Experience Manager Workflows using the AEM Java API".

You can also achieve it by creating Custom AEM Workflow step, and that step can then use AEM Java API for AEM workflows.

Link1:- https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html

Link2:- https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

Run Workflow programmatically  :- http://stackoverflow.com/questions/15233798/cq5-programmatically-run-a-workflow

//WorkflowService wfService;

WorkflowSession wfSession = wfService.getWorkflowSession(jcrSession);

WorkflowModel model = wfSession.getModel("/etc/workflow/models/x/jcr:content/model");

WorkflowData data = wfSession.newWorkflowData("JCR_PATH", payloadPath);

Workflow workflow = wfSession.startWorkflow(model, data);

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

 


I don't have a problem writing the code. Problem is DAM Offloading does not work when using it this way,

Avatar

Level 5

Jitendra S.Tomar wrote...

Hi TheBigRed,

May I know what is the use case which requires you to write a piece of code for running workflows?. Personally, I don't think, coding should be the last option. We may have to explore it.

"Writing a code isn't tough, But, tough to maintain it ".

Jitendra

 


Basically ingested bunch of files and some workflows didn't get applied to certain assets due to some server issues and AEM freezing up.

In return some files were left unprocessed. I wrote something to systematically go through folder structure and apply workflow models.

It works with any model except when the model includes DAM Asset Offloading. In the archives it says it's completed but yet nothing

actually get's done. We have nearly 30000 files unprocessed. We need Asset Offloading so our main server doesn't choke up

and doesn't affect other users using it.

 

Thanks All!