I am trying to write a workflow process step
for the DAM update asset
such that the uploaded asset will be sent to an external service that will modify the asset and then the modified asset can be sent to the Metadata extraction
step. So I've added my process step to the DAM update asset like this:
And my code looks like this so far:
public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args) throws WorkflowException {
try
{
log.info("Here2 in execute method"); //ensure that the execute method is invoked
final Map<String, Object> map = new HashMap<String, Object>();
map.put( "user.jcr.session", wfsession.getSession());
ResourceResolver rr = resolverFactory.getResourceResolver(map);
String path = item.getWorkflowData().getPayload().toString();
log.info("Here2 path: " + path);
Resource resource = rr.getResource(path);
log.info("Here2 resource: " + resource);
InputStream is = resource.adaptTo(InputStream.class);
log.info("Here2 assets IS: " + is);
}
catch (Exception e)
{
log.info("Here Error");
e.printStackTrace();
}
}
This is what I see in the logs when I upload an asset:
Here2 in execute method Here2 path: /content/dam/photo1.JPG/jcr:content/renditions/original Here2 asset: null
Question
- My external service has an API accepting requests over HTTP. How should I send over the asset to the external service?
- Once the external service modifies the asset, what should I do so that the Metadata extraction step reads the modified asset instead of the original?