Sample change log consumer
This page is a worked example of a custom change log consumer that pushes Grouper membership changes out to an external application. It uses the EsbConsumer change log consumer with a custom publisher.class (an EsbListenerBase subclass). This pattern is available in all currently supported releases (confirmed in source). For most provisioning needs, prefer the Grouper provisioning framework over writing a consumer by hand; write a custom consumer like this only when you need integration logic the framework does not provide.
A change log consumer runs inside the Grouper loader daemon, so it executes with full (root) privileges and acts on every membership it is configured to see. Configuring it requires server-side access to edit grouper-loader.properties and to deploy the consumer class on the Grouper classpath.
Configure in grouper-loader.properties
Register the consumer and point it at your publisher class. Change myApp in each configId to the name of your consumer.
# note, change "myApp" in configId to be the name of the consumer
changeLog.consumer.myApp.class = edu.internet2.middleware.grouper.changeLog.esb.consumer.EsbConsumer
# quartz cron, run every minute
changeLog.consumer.myApp.quartzCron = 0 * * * * ?
# el filter to filter events before they reach the consumer
changeLog.consumer.myApp.elfilter = (event.eventType eq 'MEMBERSHIP_UPDATE' || event.eventType eq 'MEMBERSHIP_DELETE' || event.eventType eq 'MEMBERSHIP_ADD') && (event.groupName =~ '^app\\:groups\\:.*$')
changeLog.consumer.myApp.publisher.class = edu.school.it.EsbConsumerForApp
# some ad hoc param for the consumer if needed
changeLog.consumer.myApp.publisher.groupName = a:b:c:Group
Consumer code
The consumer extends EsbListenerBase and implements dispatchEventList, which receives a batch of EsbEventContainer objects. Each event is checked in shouldProcess, then provisioned in processEvent; counts and errors are written to the daemon (loader) log so they show in the UI.