- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 05:25 AM
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=7979... 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
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 07:34 AM
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 07:34 AM
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 08:43 AM
Hi Tom,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2016 09:13 AM
Thanks for the replies. They've both been very useful
