Hi,
I have a custom implementation of a WorkflowProcess (say MyCustomWorkflowProcess), which triggers a custom replication via custom implementation of a TransportHandler (say MyCustomTransportHandler) to trigger CDN cache clear for particular content. All works well however in the event that the replication fails I'd like to be able to add the appropriate error message to the workflow step, fail the workflow and trigger an email. In my implementation of MyCustomTransportHandler I can't seem to find a way to access the workflow session to be able to add that information to the MetaDataMap object. Also, it seems that the ReplicationException thrown from MyCustomTransportHandler has no effect on my custom MyCustomWorkflowProcess so it shows up in archive folder in AEM as successful instead as in failures folder. Thanks for any suggestions.
Solved! Go to Solution.
Views
Replies
Total Likes
@AEMUSER1000 It does not like like do-able thing as you are triggering the custom replication from the workflow.
By triggered this actually you are creating a parallel thread to complete the processing. Now from this thread you can't return anything back to the workflow.
For linking two thread, what I could think is that while triggering the replication if you could see if there is any way to pass the workflow instance path along with it. And if there is any failure in the custom replication process, then you can take the resource resolver and update the workflow instance from your business logic.
But if there is a long wait between the workflow is completed and your custom replication triggers at a later point and in between the purge of the workflow happens, then you will not be able to change the state of the workflow to failure as it would have been deleted from the system.
Thanks
@AEMUSER1000 It does not like like do-able thing as you are triggering the custom replication from the workflow.
By triggered this actually you are creating a parallel thread to complete the processing. Now from this thread you can't return anything back to the workflow.
For linking two thread, what I could think is that while triggering the replication if you could see if there is any way to pass the workflow instance path along with it. And if there is any failure in the custom replication process, then you can take the resource resolver and update the workflow instance from your business logic.
But if there is a long wait between the workflow is completed and your custom replication triggers at a later point and in between the purge of the workflow happens, then you will not be able to change the state of the workflow to failure as it would have been deleted from the system.
Thanks
Thank you for the reply. What you suggest (passing workflow reference along to the replication process) may work. I'm not quite sure how to get that reference from the replication process. The workflow process invokes replication via the following:
replicator.replicate(replicationSession, getReplicationType(), aPath, replicationOptions);
Then the replication process gets invoked further down the chain with this:
public ReplicationResult deliver(TransportContext ctx, ReplicationTransaction tx) throws ReplicationException
How can I get anything from replicationSession object in the replication process via maybe the ReplicationTransaction object?
Also, I observed that throwing the ReplicationException in the replication process does not fail the workflow step, which is what I would expect to see. It seems that it is transparent and the workflow step completes successfully.
Thanks again for any suggestions.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies