Hi,
I followed this guide: https://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html to successfully create a maven project to run it on Docker. I created a simple worklflow that checks if a documentation is valid.
Now I wanted to create a Listener which will trigger after some step is completed I added this code to my process.bpmn20.xml:
<activiti:taskListener event="complete" class="com.someco.platformsample.CompleteListener"></activiti:taskListener>
Then i created a CompleteListener class:
Logger logger = Logger.getLogger(CompleteListener.class);
@override
public void notify(DelegateTask delegateTask){
// TODO Auto-generated method stub
System.out.println(delegateTask.getId());
System.out.println(delegateTask.getEventName());
System.out.println(delegateTask.getOwner());
System.out.println(delegateTask.getDescription());
logger.info(delegateTask.getId());
LocalDateTime myDateObj = LocalDateTime.now();
System.out.println("Before formatting: " + myDateObj);
DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
String formattedDate = myDateObj.format(myFormatObj);
System.out.println("After formatting: " + formattedDate);
System.out.println(formattedDate);
try {
callApi();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
When i redeployed the project and tried it out it didn't work - nothing happened. I then read somewhere you need to export the listener class (in this case CompleteListener.java) as a JAR and deploy it in /usr/local/tomcat/webapps/alfresco/WEB-INF/lib/.
Now I have a running docker container which has two images: alfresco-content-services-maven-sdk-tutorial and alfresco-share-sdk-tutorial. To be honest I didn't use Docker before and i am pretty lost. However i inspected both images and saw that alfresco-content-services-maven-sdk-tutorial has the /usr/local/tomcat/webapps/alfresco/WEB-INF/lib/ folder so I guess I have to deploy the JAR here. Can someone explain to me how this can be done? Once again the end result should be that the CompleteListener is deployed on the server and that the workflow will recognize it and trigger the code I have in the class - which will Log something to me.