The General History Eventing Producer creates history entries to History Admin. This operation can be configured through History Configuration Admin to make the producer:
The General History Eventing Producer listens for the events from only those configurations, which group is exactly the one defined in com.prosyst.mbs.services.history.producer.EventingConfigurationConstants.GROUP, i.e. "mbs/history/eventing" from the examples below:
/**
* Represents the configuration group, which is used by the eventing producer.
* By default the group is used as a namespace either.
*
* @see HistoryConfiguration#getGroup()
*/
String GROUP = "mbs/history/eventing";
For more information refer to the constant of EventingConfigurationConstants.GROUP from the API.
The examples below are different configurations, which you can try out:
{
"group": "mbs/history/eventing",
"namespacePattern": "demo/fim/switch",
"properties": {
"filter": "(uid=demo:fim:BinarySwitch:1)",
"topic": "com/prosyst/mbs/services/fim/FunctionalItemEvent/PROPERTY_CHANGED",
"value": "property.value.new"
}
}
You can also add the same History configurations programmatically using java code:
private void addEventingDemoConfiguration(HistoryConfigurationAdmin configAdmin, String demoSwichItemUID) {
// use EventingConfigurationConstants to set the configuration properties
Map<String, String> eventingProducerProps = new HashMap<String, String>(3, 1.0f);
eventingProducerProps.put(EventingConfigurationConstants.PROPERTY_FILTER,
'(' + FunctionalItem.UID + '=' + demoSwichItemUID + ')');
eventingProducerProps.put(EventingConfigurationConstants.PROPERTY_TOPIC,
FunctionalItemEventConstants.TOPIC_PROPERTY_CHANGED);
eventingProducerProps.put(EventingConfigurationConstants.PROPERTY_VALUE,
FunctionalItemEventConstants.PROPERTY_NEW_VALUE);
configAdmin.addConfiguration(EventingConfigurationConstants.GROUP, "demo/fim/switch", null, eventingProducerProps);
}
{
"group": "mbs/history/eventing",
"namespacePattern": "demo/fim/simple",
"tokenPatterns": {
"uid": "${uid}",
"property": "${property.name}"
},
"properties": {
"filter": "(&(objectClass=com.prosyst.mbs.demo.fim.BinarySwitch)(property.name=state))",
"topic": "com/prosyst/mbs/services/fim/FunctionalItemEvent/PROPERTY_CHANGED",
"value": "property.value.new"
}
}
The variables of type ${variable_name} are replaced with the values of these very keys in the event. As a result of the property change, the history entry tokens are either:
{"uid": "demo:fim:BinarySwitch:1", "property": "state"}
or
{"uid": "demo:fim:BinarySwitchExt:1", "property": "state"}
according to the demo functional item which has changed the property.