All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evento.application.manager.ConsumerComponentManager Maven / Gradle / Ivy

Go to download

Evento Framework - Bundle. The library to build a RECQ System based on Evento Server

The newest version!
package com.evento.application.manager;

import com.evento.application.performance.TracingAgent;
import com.evento.application.reference.Reference;
import lombok.Getter;
import com.evento.application.proxy.GatewayTelemetryProxy;
import com.evento.common.modeling.messaging.message.application.Message;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Supplier;

/**
 * The `ConsumerComponentManager` class serves as an abstract base class for managing consumer components that handle messages.
 *
 * @param  The type of references to components.
 */
@Getter
public abstract class ConsumerComponentManager extends ComponentManager {

    // Map to store handlers associated with this manager, organized by event name and component name
    private final HashMap> handlers = new HashMap<>();

    // List to store references to components
    private final List references = new ArrayList<>();

    // Supplier to check if the application is shutting down
    private final Supplier isShuttingDown;

    // Size of events to fetch from the state store
    private final int sssFetchSize;

    // Delay between fetching events from the state store
    private final int sssFetchDelay;

    /**
     * Constructs a `ConsumerComponentManager`.
     *
     * @param bundleId              The bundle identifier.
     * @param gatewayTelemetryProxy A function to create a `GatewayTelemetryProxy`.
     * @param tracingAgent          The tracing agent for telemetry.
     * @param isShuttingDown        A supplier to check if the application is shutting down.
     * @param sssFetchSize          Size of events to fetch from the state store.
     * @param sssFetchDelay         Delay between fetching events from the state store.
     */
    protected ConsumerComponentManager(
            String bundleId,
            BiFunction, GatewayTelemetryProxy> gatewayTelemetryProxy,
            TracingAgent tracingAgent, Supplier isShuttingDown, int sssFetchSize, int sssFetchDelay) {
        super(bundleId, gatewayTelemetryProxy, tracingAgent);
        this.isShuttingDown = isShuttingDown;
        this.sssFetchSize = sssFetchSize;
        this.sssFetchDelay = sssFetchDelay;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy