Search in sources :

Example 1 with GGMonitoredSourceInfo

use of com.linkedin.databus2.producers.db.GGMonitoredSourceInfo in project databus by linkedin.

the class GoldenGateEventProducer method buildGGMonitoredSourceInfo.

public GGMonitoredSourceInfo buildGGMonitoredSourceInfo(LogicalSourceStaticConfig sourceConfig, PhysicalSourceStaticConfig pConfig) throws DatabusException, InvalidConfigException {
    // udpate partition mapping
    PartitionFunction partitionFunction = GGEventGenerationFactory.buildPartitionFunction(sourceConfig);
    _partitionFunctionHashMap.put((int) sourceConfig.getId(), partitionFunction);
    EventSourceStatistics statisticsBean = new EventSourceStatistics(sourceConfig.getName());
    GGMonitoredSourceInfo sourceInfo = new GGMonitoredSourceInfo(sourceConfig.getId(), sourceConfig.getName(), statisticsBean);
    registerMbeans(sourceInfo);
    return sourceInfo;
}
Also used : PartitionFunction(com.linkedin.databus2.producers.PartitionFunction) EventSourceStatistics(com.linkedin.databus.monitoring.mbean.EventSourceStatistics) GGMonitoredSourceInfo(com.linkedin.databus2.producers.db.GGMonitoredSourceInfo)

Example 2 with GGMonitoredSourceInfo

use of com.linkedin.databus2.producers.db.GGMonitoredSourceInfo in project databus by linkedin.

the class GoldenGateEventProducer method registerMbeans.

// register each source with the mbeanServer
private void registerMbeans(GGMonitoredSourceInfo source) throws DatabusException {
    try {
        Hashtable<String, String> props = new Hashtable<String, String>();
        props.put("type", "SourceStatistics");
        props.put("name", source.getSourceName());
        ObjectName objectName = new ObjectName(ServerContainer.JMX_DOMAIN, props);
        if (_mbeanServer.isRegistered(objectName)) {
            _log.warn("Unregistering old gg-source statistics mbean: " + objectName);
            _mbeanServer.unregisterMBean(objectName);
        }
        _mbeanServer.registerMBean(source.getStatisticsBean(), objectName);
        _log.info("Registered gg-source statistics mbean: " + objectName);
        _registeredMbeans.add(objectName);
    } catch (Exception ex) {
        _log.error("Failed to register the gg-source statistics mbean for source (" + source.getSourceName() + ") due to an exception.", ex);
        throw new DatabusException("Failed to initialize gg event statistics mbeans.", ex);
    }
}
Also used : DatabusException(com.linkedin.databus2.core.DatabusException) Hashtable(java.util.Hashtable) XMLStreamException(javax.xml.stream.XMLStreamException) NotImplementedException(org.apache.commons.lang.NotImplementedException) DatabusException(com.linkedin.databus2.core.DatabusException) InvalidConfigException(com.linkedin.databus.core.util.InvalidConfigException) UnsupportedKeyException(com.linkedin.databus.core.UnsupportedKeyException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) EventCreationException(com.linkedin.databus2.producers.EventCreationException) IOException(java.io.IOException) ObjectName(javax.management.ObjectName)

Aggregations

UnsupportedKeyException (com.linkedin.databus.core.UnsupportedKeyException)1 InvalidConfigException (com.linkedin.databus.core.util.InvalidConfigException)1 EventSourceStatistics (com.linkedin.databus.monitoring.mbean.EventSourceStatistics)1 DatabusException (com.linkedin.databus2.core.DatabusException)1 EventCreationException (com.linkedin.databus2.producers.EventCreationException)1 PartitionFunction (com.linkedin.databus2.producers.PartitionFunction)1 GGMonitoredSourceInfo (com.linkedin.databus2.producers.db.GGMonitoredSourceInfo)1 IOException (java.io.IOException)1 Hashtable (java.util.Hashtable)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 ObjectName (javax.management.ObjectName)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 NotImplementedException (org.apache.commons.lang.NotImplementedException)1