use of org.folio.kafka.SubscriptionDefinition in project mod-source-record-storage by folio-org.
the class DataImportConsumersVerticle method start.
@Override
public void start(Promise<Void> startPromise) {
context.put("springContext", springGlobalContext);
SpringContextUtil.autowireDependencies(this, context);
EventManager.registerKafkaEventPublisher(kafkaConfig, vertx, maxDistributionNumber);
events.forEach(event -> {
SubscriptionDefinition subscriptionDefinition = KafkaTopicNameHelper.createSubscriptionDefinition(kafkaConfig.getEnvId(), KafkaTopicNameHelper.getDefaultNameSpace(), event);
consumerWrappersList.add(KafkaConsumerWrapper.<String, String>builder().context(context).vertx(vertx).kafkaConfig(kafkaConfig).loadLimit(loadLimit).globalLoadSensor(globalLoadSensor).subscriptionDefinition(subscriptionDefinition).build());
});
List<Future<Void>> futures = new ArrayList<>();
consumerWrappersList.forEach(consumerWrapper -> futures.add(consumerWrapper.start(dataImportKafkaHandler, constructModuleName() + "_" + getClass().getSimpleName())));
GenericCompositeFuture.all(futures).onComplete(ar -> startPromise.complete());
}
use of org.folio.kafka.SubscriptionDefinition in project mod-source-record-storage by folio-org.
the class QuickMarcConsumersVerticle method start.
@Override
public void start(Promise<Void> startPromise) {
context.put("springContext", springGlobalContext);
SpringContextUtil.autowireDependencies(this, context);
SubscriptionDefinition subscriptionDefinition = KafkaTopicNameHelper.createSubscriptionDefinition(kafkaConfig.getEnvId(), KafkaTopicNameHelper.getDefaultNameSpace(), QMEventTypes.QM_RECORD_UPDATED.name());
consumer = KafkaConsumerWrapper.<String, String>builder().context(context).vertx(vertx).kafkaConfig(kafkaConfig).loadLimit(loadLimit).globalLoadSensor(globalLoadSensor).subscriptionDefinition(subscriptionDefinition).build();
consumer.start(kafkaHandler, constructModuleName() + "_" + getClass().getSimpleName()).onComplete(ar -> startPromise.complete());
}
use of org.folio.kafka.SubscriptionDefinition in project mod-invoice by folio-org.
the class DataImportConsumerVerticle method start.
@Override
public void start(Promise<Void> startPromise) {
context.put("springContext", springContext);
logger.info("Kafka config: {}", kafkaConfig);
EventManager.registerKafkaEventPublisher(kafkaConfig, vertx, maxDistributionNumber);
SubscriptionDefinition subscriptionDefinition = KafkaTopicNameHelper.createSubscriptionDefinition(kafkaConfig.getEnvId(), KafkaTopicNameHelper.getDefaultNameSpace(), DI_EDIFACT_RECORD_CREATED.value());
consumerWrapper = KafkaConsumerWrapper.<String, String>builder().context(context).vertx(vertx).kafkaConfig(kafkaConfig).loadLimit(loadLimit).globalLoadSensor(GLOBAL_LOAD_SENSOR).subscriptionDefinition(subscriptionDefinition).build();
consumerWrapper.start(dataImportKafkaHandler, PomReaderUtil.INSTANCE.constructModuleVersionAndVersion(PomReaderUtil.INSTANCE.getModuleName(), PomReaderUtil.INSTANCE.getVersion())).onComplete(ar -> startPromise.handle(ar));
}
use of org.folio.kafka.SubscriptionDefinition in project mod-inventory by folio-org.
the class DataImportConsumerVerticle method createKafkaConsumerWrapper.
private Future<KafkaConsumerWrapper<String, String>> createKafkaConsumerWrapper(KafkaConfig kafkaConfig, DataImportEventTypes eventType, AsyncRecordHandler<String, String> recordHandler) {
SubscriptionDefinition subscriptionDefinition = KafkaTopicNameHelper.createSubscriptionDefinition(kafkaConfig.getEnvId(), KafkaTopicNameHelper.getDefaultNameSpace(), eventType.value());
KafkaConsumerWrapper<String, String> consumerWrapper = KafkaConsumerWrapper.<String, String>builder().context(context).vertx(vertx).kafkaConfig(kafkaConfig).loadLimit(loadLimit).globalLoadSensor(new GlobalLoadSensor()).subscriptionDefinition(subscriptionDefinition).build();
return consumerWrapper.start(recordHandler, ConsumerWrapperUtil.constructModuleName()).map(consumerWrapper);
}
use of org.folio.kafka.SubscriptionDefinition in project mod-source-record-storage by folio-org.
the class ParsedRecordChunkConsumersVerticle method start.
@Override
public void start(Promise<Void> startPromise) {
context.put("springContext", springGlobalContext);
SpringContextUtil.autowireDependencies(this, context);
SubscriptionDefinition subscriptionDefinition = KafkaTopicNameHelper.createSubscriptionDefinition(kafkaConfig.getEnvId(), KafkaTopicNameHelper.getDefaultNameSpace(), DI_RAW_RECORDS_CHUNK_PARSED.value());
consumerWrapper = KafkaConsumerWrapper.<String, String>builder().context(context).vertx(vertx).kafkaConfig(kafkaConfig).loadLimit(loadLimit).globalLoadSensor(globalLoadSensor).subscriptionDefinition(subscriptionDefinition).processRecordErrorHandler(parsedRecordChunksErrorHandler).build();
consumerWrapper.start(parsedRecordChunksKafkaHandler, constructModuleName() + "_" + getClass().getSimpleName()).onComplete(sar -> {
if (sar.succeeded()) {
startPromise.complete();
} else {
startPromise.fail(sar.cause());
}
});
}
Aggregations