Search in sources :

Example 1 with JmxTransQueryTemplate

use of io.strimzi.api.kafka.model.template.JmxTransQueryTemplate in project strimzi by strimzi.

the class JmxTrans method convertSpecToServers.

private JmxTransServer convertSpecToServers(JmxTransSpec spec, String brokerServiceName) {
    JmxTransServer server = new JmxTransServer();
    server.setHost(brokerServiceName);
    server.setPort(AbstractModel.JMX_PORT);
    if (isJmxAuthenticated()) {
        server.setUsername("${kafka.username}");
        server.setPassword("${kafka.password}");
    }
    List<JmxTransQueries> queries = new ArrayList<>();
    for (JmxTransQueryTemplate queryTemplate : spec.getKafkaQueries()) {
        JmxTransQueries query = new JmxTransQueries();
        query.setObj(queryTemplate.getTargetMBean());
        query.setAttr(queryTemplate.getAttributes());
        query.setOutputWriters(new ArrayList<>());
        for (JmxTransOutputDefinitionTemplate outputDefinitionTemplate : spec.getOutputDefinitions()) {
            if (queryTemplate.getOutputs().contains(outputDefinitionTemplate.getName())) {
                JmxTransOutputWriter outputWriter = new JmxTransOutputWriter();
                outputWriter.setAtClass(outputDefinitionTemplate.getOutputType());
                if (outputDefinitionTemplate.getHost() != null) {
                    outputWriter.setHost(outputDefinitionTemplate.getHost());
                }
                if (outputDefinitionTemplate.getPort() != null) {
                    outputWriter.setPort(outputDefinitionTemplate.getPort());
                }
                if (outputDefinitionTemplate.getFlushDelayInSeconds() != null) {
                    outputWriter.setFlushDelayInSeconds(outputDefinitionTemplate.getFlushDelayInSeconds());
                }
                outputWriter.setTypeNames(outputDefinitionTemplate.getTypeNames());
                query.getOutputWriters().add(outputWriter);
            }
        }
        queries.add(query);
    }
    server.setQueries(queries);
    return server;
}
Also used : ArrayList(java.util.ArrayList) JmxTransServer(io.strimzi.operator.cluster.model.components.JmxTransServer) JmxTransOutputDefinitionTemplate(io.strimzi.api.kafka.model.template.JmxTransOutputDefinitionTemplate) JmxTransOutputWriter(io.strimzi.operator.cluster.model.components.JmxTransOutputWriter) JmxTransQueries(io.strimzi.operator.cluster.model.components.JmxTransQueries) JmxTransQueryTemplate(io.strimzi.api.kafka.model.template.JmxTransQueryTemplate)

Example 2 with JmxTransQueryTemplate

use of io.strimzi.api.kafka.model.template.JmxTransQueryTemplate in project strimzi-kafka-operator by strimzi.

the class JmxTrans method jmxTransQueries.

/**
 * Generates the queries for the JMX Trans configuration
 *
 * @return  List with JMX Trans queries
 */
private List<JmxTransQueries> jmxTransQueries() {
    List<JmxTransQueries> queries = new ArrayList<>(kafkaQueries.size());
    for (JmxTransQueryTemplate queryTemplate : kafkaQueries) {
        JmxTransQueries query = new JmxTransQueries();
        query.setObj(queryTemplate.getTargetMBean());
        query.setAttr(queryTemplate.getAttributes());
        query.setOutputWriters(new ArrayList<>());
        for (JmxTransOutputDefinitionTemplate outputDefinitionTemplate : outputDefinitions) {
            if (queryTemplate.getOutputs().contains(outputDefinitionTemplate.getName())) {
                JmxTransOutputWriter outputWriter = new JmxTransOutputWriter();
                outputWriter.setAtClass(outputDefinitionTemplate.getOutputType());
                if (outputDefinitionTemplate.getHost() != null) {
                    outputWriter.setHost(outputDefinitionTemplate.getHost());
                }
                if (outputDefinitionTemplate.getPort() != null) {
                    outputWriter.setPort(outputDefinitionTemplate.getPort());
                }
                if (outputDefinitionTemplate.getFlushDelayInSeconds() != null) {
                    outputWriter.setFlushDelayInSeconds(outputDefinitionTemplate.getFlushDelayInSeconds());
                }
                outputWriter.setTypeNames(outputDefinitionTemplate.getTypeNames());
                query.getOutputWriters().add(outputWriter);
            }
        }
        queries.add(query);
    }
    return queries;
}
Also used : ArrayList(java.util.ArrayList) JmxTransOutputDefinitionTemplate(io.strimzi.api.kafka.model.template.JmxTransOutputDefinitionTemplate) JmxTransOutputWriter(io.strimzi.operator.cluster.model.components.JmxTransOutputWriter) JmxTransQueries(io.strimzi.operator.cluster.model.components.JmxTransQueries) JmxTransQueryTemplate(io.strimzi.api.kafka.model.template.JmxTransQueryTemplate)

Example 3 with JmxTransQueryTemplate

use of io.strimzi.api.kafka.model.template.JmxTransQueryTemplate in project strimzi by strimzi.

the class JmxTrans method jmxTransQueries.

/**
 * Generates the queries for the JMX Trans configuration
 *
 * @return  List with JMX Trans queries
 */
private List<JmxTransQueries> jmxTransQueries() {
    List<JmxTransQueries> queries = new ArrayList<>(kafkaQueries.size());
    for (JmxTransQueryTemplate queryTemplate : kafkaQueries) {
        JmxTransQueries query = new JmxTransQueries();
        query.setObj(queryTemplate.getTargetMBean());
        query.setAttr(queryTemplate.getAttributes());
        query.setOutputWriters(new ArrayList<>());
        for (JmxTransOutputDefinitionTemplate outputDefinitionTemplate : outputDefinitions) {
            if (queryTemplate.getOutputs().contains(outputDefinitionTemplate.getName())) {
                JmxTransOutputWriter outputWriter = new JmxTransOutputWriter();
                outputWriter.setAtClass(outputDefinitionTemplate.getOutputType());
                if (outputDefinitionTemplate.getHost() != null) {
                    outputWriter.setHost(outputDefinitionTemplate.getHost());
                }
                if (outputDefinitionTemplate.getPort() != null) {
                    outputWriter.setPort(outputDefinitionTemplate.getPort());
                }
                if (outputDefinitionTemplate.getFlushDelayInSeconds() != null) {
                    outputWriter.setFlushDelayInSeconds(outputDefinitionTemplate.getFlushDelayInSeconds());
                }
                outputWriter.setTypeNames(outputDefinitionTemplate.getTypeNames());
                query.getOutputWriters().add(outputWriter);
            }
        }
        queries.add(query);
    }
    return queries;
}
Also used : ArrayList(java.util.ArrayList) JmxTransOutputDefinitionTemplate(io.strimzi.api.kafka.model.template.JmxTransOutputDefinitionTemplate) JmxTransOutputWriter(io.strimzi.operator.cluster.model.components.JmxTransOutputWriter) JmxTransQueries(io.strimzi.operator.cluster.model.components.JmxTransQueries) JmxTransQueryTemplate(io.strimzi.api.kafka.model.template.JmxTransQueryTemplate)

Example 4 with JmxTransQueryTemplate

use of io.strimzi.api.kafka.model.template.JmxTransQueryTemplate in project strimzi-kafka-operator by strimzi.

the class JmxTrans method convertSpecToServers.

private JmxTransServer convertSpecToServers(JmxTransSpec spec, String brokerServiceName) {
    JmxTransServer server = new JmxTransServer();
    server.setHost(brokerServiceName);
    server.setPort(AbstractModel.JMX_PORT);
    if (isJmxAuthenticated()) {
        server.setUsername("${kafka.username}");
        server.setPassword("${kafka.password}");
    }
    List<JmxTransQueries> queries = new ArrayList<>();
    for (JmxTransQueryTemplate queryTemplate : spec.getKafkaQueries()) {
        JmxTransQueries query = new JmxTransQueries();
        query.setObj(queryTemplate.getTargetMBean());
        query.setAttr(queryTemplate.getAttributes());
        query.setOutputWriters(new ArrayList<>());
        for (JmxTransOutputDefinitionTemplate outputDefinitionTemplate : spec.getOutputDefinitions()) {
            if (queryTemplate.getOutputs().contains(outputDefinitionTemplate.getName())) {
                JmxTransOutputWriter outputWriter = new JmxTransOutputWriter();
                outputWriter.setAtClass(outputDefinitionTemplate.getOutputType());
                if (outputDefinitionTemplate.getHost() != null) {
                    outputWriter.setHost(outputDefinitionTemplate.getHost());
                }
                if (outputDefinitionTemplate.getPort() != null) {
                    outputWriter.setPort(outputDefinitionTemplate.getPort());
                }
                if (outputDefinitionTemplate.getFlushDelayInSeconds() != null) {
                    outputWriter.setFlushDelayInSeconds(outputDefinitionTemplate.getFlushDelayInSeconds());
                }
                outputWriter.setTypeNames(outputDefinitionTemplate.getTypeNames());
                query.getOutputWriters().add(outputWriter);
            }
        }
        queries.add(query);
    }
    server.setQueries(queries);
    return server;
}
Also used : ArrayList(java.util.ArrayList) JmxTransServer(io.strimzi.operator.cluster.model.components.JmxTransServer) JmxTransOutputDefinitionTemplate(io.strimzi.api.kafka.model.template.JmxTransOutputDefinitionTemplate) JmxTransOutputWriter(io.strimzi.operator.cluster.model.components.JmxTransOutputWriter) JmxTransQueries(io.strimzi.operator.cluster.model.components.JmxTransQueries) JmxTransQueryTemplate(io.strimzi.api.kafka.model.template.JmxTransQueryTemplate)

Aggregations

JmxTransOutputDefinitionTemplate (io.strimzi.api.kafka.model.template.JmxTransOutputDefinitionTemplate)4 JmxTransQueryTemplate (io.strimzi.api.kafka.model.template.JmxTransQueryTemplate)4 JmxTransOutputWriter (io.strimzi.operator.cluster.model.components.JmxTransOutputWriter)4 JmxTransQueries (io.strimzi.operator.cluster.model.components.JmxTransQueries)4 ArrayList (java.util.ArrayList)4 JmxTransServer (io.strimzi.operator.cluster.model.components.JmxTransServer)2