Hello all,
I'm looking for some information on how to replace the DefaultHistoryManager with my own implementation.
I found this thread https://community.alfresco.com/message/797997-re-disable-history-for-specific-process?commentID=797997#comment-797997 so I know which interface I have to implement but how do I go about configuring Activiti to use my new implementation?
Any advice is appreciated.
Tom
Hi Tom,
For registering a new HistoryManager then you have to create the HistoryManager,
class MyHistoryManager extends AbstractManager implements HistoryManager{ ... }
the SessionFactory ,
public class MyHistoryManagerSessionFactory implements SessionFactory { public java.lang.Class<?> getSessionType() { return HistoryManager.class; } @Override public Session openSession() { return new MyHistoryManager(); } }
and then just inject the sessionFactory into the engine using configurations like that:
<bean id="processEngineConfiguration" class="...SomeProcessEngineConfigurationClass"> ... <property name="customSessionFactories"> <list> <bean class="com.mycompany.MyHistoryManagerSessionFactory"/> </list> </property> ...</bean>
Vasili's answer is absolutely correct, but implementing a complete history manager may be overkill for what you need.
Somewhere around 5.16, the "event" subsystem was introduced (documented here: Activiti User Guide ).
This allows you to register for any event and act accordingly.
We use this mechanism to integrate into such things as NoSQL storage for reporting (e.g. Elasticsearch) as it acts in addition to the existing history tables and will not impact the operation of the history and management REST (and Java) API.
But, if you are looking for a full replacement, then Vasili's directions are correct.
Regards,
Greg
Thanks for the replies. They've both been very useful