Closure is used in RFA registerCllient() method to pass any application specific data to the processEvent() callback function. For example, we need to know the item name of a update event in order to apply the update data to the application data. However, Item name is only available in the AttributInfo object which is usuallyanly available in the Refresh event. Update events do not have AttributInfo unless requested specifically. We can pass the Item name when we subscribe the item:
Handle itemHandle = _mainApp.getOMMConsumer().registerClient(_mainApp.getEventQueue(), ommItemIntSpec, this, itemName);
In ProcessEvent(), simply call getClosure() method to retrieve the itemName:
OMMItemEvent ie = (OMMItemEvent)event; String _ric = (String) ie.getClosure(); System.out.println("ItemName:" + _ric);
Regarding the RFA Developer Guide, the closure object is a application-defined use. An application may supply a closure object on sending an Interest Specification. RFA returns the Closure in Events. A closure is a reference to an object supplied by the application.