cancel
Showing results for 
Search instead for 
Did you mean: 

generating log file using process engine

slaimankoeik
Champ in-the-making
Champ in-the-making
hi, i'm working on a big data project for my master's 2 study, i'm saying this to tell you how much my question is important.
going into my project, i have a business process in the domain of logistics and this business process have to generate a plenty of log files and data collected from different data sources like IOT devices in every seconds, later on these log files and IOT data are used for real-time analysis.
ok, here my point is i have a complex business process, which have to generate log files containing data like (name of claiming user, time of claiming, start time of activity, end time of activity, activity id, start time of process, end time of process …… ) , ok as i started to read about how to generate log files containing these data and if there an a automatize way to generate such log files containing such data on activities, i found that process engine is responsible for this mechanism, but i didn't really understand how.
so can anybody help me with that ?

Regards,
slaiman
8 REPLIES 8

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Slaiman,

Activiti supports 2 ways of storing info about the history:
1. http://activiti.org/userguide/index.html#historyConfiguration
2. http://activiti.org/userguide/index.html#eventDispatcher

Regards
Martin

slaimankoeik
Champ in-the-making
Champ in-the-making
Thank you martin for your feedback, but i want to explain a point according to my reading and my understanding of the process engine in the activiti tool, and correct for me if i erred, here is the point:
-At runtime the process engine seems to save the history data collected from process, activities, variables, users etc… into the data base, and then developer can query the data from the "HistoryService", But what i want is to get the data(generated by the process engine) from the process engine directly without waiting these milliseconds for these data to be written to the database.
so my key point is getting the data directly from the process engine and not from the "HistoryService" class, so i'm asking if there is a way to achieve this goal ?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Slaiman,

I did not understand the usecase, but you can get it immediately when you will register event listener (option 2).

Regards
Martin

jbarrez
Star Contributor
Star Contributor
Martin is correct, using an event listener and writing the history data to whatever data store you prefer is the way to go.

slaimankoeik
Champ in-the-making
Champ in-the-making
thank you martin & jbarrez for your feedback, however i going to repeat my usecase and i will upload the code, you will find it attached by this message.
here we go, i have a business process in the domain of logistics, the activities in this business process like UserTasks ( request for trucks, load trucks, unload trucks, acknowledgment) these activities have a self generated data by the process Engine like (name of task, start time, end time, duration, user assigned to this task)  these data when generated by process engine are stored in an in-memory database to be queried by the "History Service", I've implemented this method and it is going fine, that's one.

-second, my usecase is to capture the data generated by the process engine BEFORE it is stored in the in-memory database, which means i don't want to wait these milliseconds for the process engine to store them because these milliseconds are important to me. for this usecase, you martin and jbarrez presented for me a second method for my usecase which you reference it by option 2 in your comment, well according to your method i created a class which implements the "ActivitiEventListener" interface which captures all the events, so here i can know the events generated by my business process, ok that's good but here the missing thing is the data (information) which is very important, like this event for which activiti it belongs ? what is the activiti's name belong which generated this event ? when it started ? when it ends ? the answers of these questions are the information i need, i'm missing them in the method you offered to me.
how can i extract these information in the class implementing the "ActivitiEventListener" interface ??

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Salaiman,

the only place from which you can get these information is org.activiti.engine.delegate.event.ActivitiEvent. If the info is not there change the Event and the way how it is fired. (and create pull request to the master code)

Regards
Martin

slaimankoeik
Champ in-the-making
Champ in-the-making
Hi martin.grofcik, you said:
[size=24]
If the info is not there change the Event and the way how it is fired. (and create pull request to the master code)
[/size]

how can i change the event and the way it is fired ??

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Slaiman,

Activiti is opensource project distributed under ASF license.

Make the change in the activiti source code and create a pull request to the project.

Regards
Martin