Search in sources :

Example 1 with KafkaConfig

use of org.folio.kafka.KafkaConfig in project mod-inventory by folio-org.

the class QuickMarcConsumerVerticle method getKafkaConfig.

private KafkaConfig getKafkaConfig(JsonObject config) {
    KafkaConfig kafkaConfig = KafkaConfig.builder().envId(config.getString(KAFKA_ENV)).kafkaHost(config.getString(KAFKA_HOST)).kafkaPort(config.getString(KAFKA_PORT)).okapiUrl(config.getString(OKAPI_URL)).replicationFactor(Integer.parseInt(config.getString(KAFKA_REPLICATION_FACTOR))).maxRequestSize(Integer.parseInt(config.getString(KAFKA_MAX_REQUEST_SIZE))).build();
    LOGGER.info("kafkaConfig: {}", kafkaConfig);
    return kafkaConfig;
}
Also used : KafkaConfig(org.folio.kafka.KafkaConfig)

Example 2 with KafkaConfig

use of org.folio.kafka.KafkaConfig in project mod-inventory by folio-org.

the class DataImportKafkaHandlerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.openMocks(this);
    String[] hostAndPort = cluster.getBrokerList().split(":");
    WireMock.stubFor(get(new UrlPathPattern(new RegexPattern(JOB_PROFILE_URL + "/.*"), true)).willReturn(WireMock.ok().withBody(Json.encode(profileSnapshotWrapper))));
    KafkaConfig kafkaConfig = KafkaConfig.builder().kafkaHost(hostAndPort[0]).kafkaPort(hostAndPort[1]).maxRequestSize(1048576).build();
    HttpClient client = vertx.createHttpClient(new HttpClientOptions().setConnectTimeout(3000));
    dataImportKafkaHandler = new DataImportKafkaHandler(vertx, mockedStorage, client, new ProfileSnapshotCache(vertx, client, 3600), kafkaConfig, new MappingMetadataCache(vertx, client, 3600));
    EventManager.clearEventHandlers();
    EventManager.registerKafkaEventPublisher(kafkaConfig, vertx, 1);
}
Also used : UrlPathPattern(com.github.tomakehurst.wiremock.matching.UrlPathPattern) RegexPattern(com.github.tomakehurst.wiremock.matching.RegexPattern) MappingMetadataCache(org.folio.inventory.dataimport.cache.MappingMetadataCache) HttpClient(io.vertx.core.http.HttpClient) ProfileSnapshotCache(org.folio.inventory.dataimport.cache.ProfileSnapshotCache) HttpClientOptions(io.vertx.core.http.HttpClientOptions) KafkaConfig(org.folio.kafka.KafkaConfig) Before(org.junit.Before)

Example 3 with KafkaConfig

use of org.folio.kafka.KafkaConfig in project mod-source-record-storage by folio-org.

the class ApplicationConfig method kafkaConfigBean.

@Bean(name = "newKafkaConfig")
public KafkaConfig kafkaConfigBean() {
    KafkaConfig kafkaConfig = KafkaConfig.builder().envId(envId).kafkaHost(kafkaHost).kafkaPort(kafkaPort).okapiUrl(okapiUrl).replicationFactor(replicationFactor).maxRequestSize(maxRequestSize).build();
    LOGGER.debug("kafkaConfig: {}", kafkaConfig);
    return kafkaConfig;
}
Also used : KafkaConfig(org.folio.kafka.KafkaConfig) Bean(org.springframework.context.annotation.Bean)

Example 4 with KafkaConfig

use of org.folio.kafka.KafkaConfig in project mod-source-record-manager by folio-org.

the class ApplicationConfig method kafkaConfigBean.

@Bean(name = "newKafkaConfig")
public KafkaConfig kafkaConfigBean() {
    KafkaConfig kafkaConfig = KafkaConfig.builder().envId(envId).kafkaHost(kafkaHost).kafkaPort(kafkaPort).okapiUrl(okapiUrl).replicationFactor(replicationFactor).maxRequestSize(maxRequestSize).build();
    LOGGER.info("kafkaConfig: " + kafkaConfig);
    return kafkaConfig;
}
Also used : KafkaConfig(org.folio.kafka.KafkaConfig) Bean(org.springframework.context.annotation.Bean)

Example 5 with KafkaConfig

use of org.folio.kafka.KafkaConfig in project mod-inventory by folio-org.

the class DataImportConsumerVerticleTest method setUpClass.

@BeforeClass
public static void setUpClass(TestContext context) {
    Async async = context.async();
    String[] hostAndPort = cluster.getBrokerList().split(":");
    KafkaConfig kafkaConfig = KafkaConfig.builder().kafkaHost(hostAndPort[0]).kafkaPort(hostAndPort[1]).build();
    EventManager.registerKafkaEventPublisher(kafkaConfig, vertx, 1);
    vertx = Vertx.vertx();
    DeploymentOptions options = new DeploymentOptions().setConfig(new JsonObject().put(KAFKA_HOST, hostAndPort[0]).put(KAFKA_PORT, hostAndPort[1]).put(KAFKA_REPLICATION_FACTOR, "1").put(KAFKA_ENV, KAFKA_ENV_NAME).put(KAFKA_MAX_REQUEST_SIZE, "1048576"));
    vertx.deployVerticle(DataImportConsumerVerticle.class.getName(), options, deployAr -> async.complete());
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) DataImportConsumerVerticle(org.folio.inventory.DataImportConsumerVerticle) Async(io.vertx.ext.unit.Async) JsonObject(io.vertx.core.json.JsonObject) KafkaConfig(org.folio.kafka.KafkaConfig) BeforeClass(org.junit.BeforeClass)

Aggregations

KafkaConfig (org.folio.kafka.KafkaConfig)9 JsonObject (io.vertx.core.json.JsonObject)5 HttpClient (io.vertx.core.http.HttpClient)4 MappingMetadataCache (org.folio.inventory.dataimport.cache.MappingMetadataCache)3 Storage (org.folio.inventory.storage.Storage)3 DeploymentOptions (io.vertx.core.DeploymentOptions)2 HttpClientOptions (io.vertx.core.http.HttpClientOptions)2 Async (io.vertx.ext.unit.Async)2 BeforeClass (org.junit.BeforeClass)2 Bean (org.springframework.context.annotation.Bean)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)1 UrlPathPattern (com.github.tomakehurst.wiremock.matching.UrlPathPattern)1 RestAssured (io.restassured.RestAssured)1 ObjectMapperConfig (io.restassured.config.ObjectMapperConfig)1 RestAssuredConfig (io.restassured.config.RestAssuredConfig)1 Jackson2ObjectMapperFactory (io.restassured.path.json.mapper.factory.Jackson2ObjectMapperFactory)1 AbstractVerticle (io.vertx.core.AbstractVerticle)1 CompositeFuture (io.vertx.core.CompositeFuture)1 Future (io.vertx.core.Future)1