ocp_rules_consumer.go

/* Copyright © 2020, 2021, 2022, 2023 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */

Package consumer contains interface for any consumer that is able to process messages. It also contains implementation of Kafka consumer.

It is expected that consumed messages are generated by ccx-data-pipeline based on OCP rules framework. The report generated by the framework are enhanced with more context information taken from different sources, like the organization ID, account number, unique cluster name, and the LastChecked timestamp (taken from the incoming Kafka record containing the URL to the archive).

It is also expected that consumed messages contains one INFO rule hit that contains cluster version. That rule hit is produced by special rule used only in external data pipeline: "versioninfo|CLUSTERVERSION_INFO"

package
consumer
import
(
"github.com/RedHatInsights/insights-results-aggregator/broker"
"github.com/RedHatInsights/insights-results-aggregator/storage"
)

NewOCPRulesConsumer constructs new implementation of Consumer interface

func
NewOCPRulesConsumer
(
brokerCfg
broker
.
Configuration
,
storage
storage
.
OCPRecommendationsStorage
)
(
*
KafkaConsumer
,
error
)
{
return
NewKafkaConsumer
(
brokerCfg
,
storage
,
OCPRulesProcessor
{
}
)
}