Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

call workflow execute method in OSGi servicec

Avatar

Level 2

I am trying to include com.adobe.cq.wcm.translation.impl.process.SyncTranslationProcess as reference in my OSGi service. How can i include it?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Technically you can create a reference to a specific OSGI service, but in most cases that's not really necessary and also bad design.

@Reference(target=("component.name=com.adobe.cq.wcm.translation.impl.process.SyncTranslationProcess"))

WorkflowProcess syncTranslationProcess

(check How do I specify an implementation using @OSGiService for some more details). But I don't think that is a good idea. First of all you need to get the right parameters (and creating a WorkflowSession manually is not recommended at all). Also invoking this workflow step from a custom other workflow step does not make sense to me, you should rather re-design your workflow.

View solution in original post

4 Replies

Avatar

Level 10

Are you following an online resource. 

I am not seeing this Java class in the AEM Javadocs: "The Adobe AEM Quickstart and Web Application."

What exactly are you trying to do?  Are you trying to invoke a workflow from another AEM Service?

Avatar

Level 2

Yes, I am trying to invoke a workflow from an AEM service which is leading to a race condition hence I was thinking if I can Invoke the execute method.. as my service is leading to another workflow..

In short I wanted to extract the logic that is there in a workflow.. as workflow have bootle neck if the workflow queue is exhausted.

In the AEM bootstrap translation connector I am using Sync Translation WF to create translation export and using that export file in createTranslationJob

Avatar

Correct answer by
Employee Advisor

Technically you can create a reference to a specific OSGI service, but in most cases that's not really necessary and also bad design.

@Reference(target=("component.name=com.adobe.cq.wcm.translation.impl.process.SyncTranslationProcess"))

WorkflowProcess syncTranslationProcess

(check How do I specify an implementation using @OSGiService for some more details). But I don't think that is a good idea. First of all you need to get the right parameters (and creating a WorkflowSession manually is not recommended at all). Also invoking this workflow step from a custom other workflow step does not make sense to me, you should rather re-design your workflow.

Avatar

Level 2

Thanks Jorg for the advise. I changed my workflow design, not sure why it did not strike me earlier. Thanks again!