protected void activate()

in src/main/java/org/apache/sling/event/dea/impl/DistributedEventAdminImpl.java [82:103]


    protected void activate(final BundleContext bundleContext, final Config props) {
        final String ownRootPath = props.repository_path().concat("/").concat(settings.getSlingId());

        this.receiver = new DistributedEventReceiver(bundleContext,
                props.repository_path(),
                ownRootPath,
                props.cleanup_period(),
                this.resourceResolverFactory, this.settings);
        this.sender = new DistributedEventSender(bundleContext,
                              props.repository_path(),
                              ownRootPath,
                              this.resourceResolverFactory, this.eventAdmin);
        
        if (metrics != null) {
            // It's easier to use a gauge here instead of passing the (optional) MetricsRegistry into 
            // each of these 2 services, so they can register counters themselves.
            metrics.gauge("org.apache.sling.event.dea.receiver.successCounter", receiver::getSuccessCounter);
            metrics.gauge("org.apache.sling.event.dea.receiver.failureCounter", receiver::getFailureCounter);
            metrics.gauge("org.apache.sling.event.dea.sender.postedEventsCounter", sender::getPostedEventCounter);
        }
        
    }