call workflow execute method in OSGi servicec | Community
Skip to main content
Level 2
Oct 23, 2018 5:21 PM UTC
Solved

call workflow execute method in OSGi servicec

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
joerghoh
joerghohAccepted solution
Employee
Oct 23, 2018 6:48 PM UTC

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.

4 replies

Level 2
Oct 25, 2018 4:19 AM UTC

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

Translate
joerghoh
joerghohAccepted solution
Employee
Oct 23, 2018 6:48 PM UTC

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.

Translate
Level 2
Oct 23, 2018 5:49 PM UTC

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

Translate
smacdonald2008
Level 10
Oct 23, 2018 5:26 PM UTC

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?

Translate