Search in sources :

Example 1 with LocalToKafkaCommand

use of org.locationtech.geowave.core.ingest.operations.LocalToKafkaCommand in project geowave by locationtech.

the class GeoWaveGrpcCoreIngestService method localToKafkaCommand.

@Override
public void localToKafkaCommand(final org.locationtech.geowave.service.grpc.protobuf.LocalToKafkaCommandParametersProtos request, final StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos> responseObserver) {
    final LocalToKafkaCommand cmd = new LocalToKafkaCommand();
    final Map<FieldDescriptor, Object> m = request.getAllFields();
    GeoWaveGrpcServiceCommandUtil.setGrpcToCommandFields(m, cmd);
    final File configFile = GeoWaveGrpcServiceOptions.geowaveConfigFile;
    final OperationParams params = new ManualOperationParams();
    params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
    cmd.prepare(params);
    LOGGER.info("Executing LocalToKafkaCommand...");
    try {
        cmd.computeResults(params);
        final VoidResponseProtos resp = VoidResponseProtos.newBuilder().build();
        responseObserver.onNext(resp);
        responseObserver.onCompleted();
    } catch (final Exception e) {
        LOGGER.error("Exception encountered executing command", e);
        responseObserver.onError(e);
    }
}
Also used : VoidResponseProtos(org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos) OperationParams(org.locationtech.geowave.core.cli.api.OperationParams) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams) LocalToKafkaCommand(org.locationtech.geowave.core.ingest.operations.LocalToKafkaCommand) File(java.io.File) FieldDescriptor(com.google.protobuf.Descriptors.FieldDescriptor) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Example 2 with LocalToKafkaCommand

use of org.locationtech.geowave.core.ingest.operations.LocalToKafkaCommand in project geowave by locationtech.

the class KafkaTestUtils method testKafkaStage.

public static void testKafkaStage(final String ingestFilePath) throws Exception {
    // Ingest Formats
    final IngestFormatPluginOptions ingestFormatOptions = new IngestFormatPluginOptions();
    ingestFormatOptions.selectPlugin("gpx");
    final LocalToKafkaCommand localToKafka = new LocalToKafkaCommand();
    localToKafka.setParameters(ingestFilePath);
    localToKafka.setPluginFormats(ingestFormatOptions);
    localToKafka.getKafkaOptions().setBootstrapServers(KafkaTestEnvironment.getInstance().getBootstrapServers());
    localToKafka.getKafkaOptions().setRetryBackoffMs("1000");
    localToKafka.execute(new ManualOperationParams());
}
Also used : IngestFormatPluginOptions(org.locationtech.geowave.core.ingest.operations.options.IngestFormatPluginOptions) LocalToKafkaCommand(org.locationtech.geowave.core.ingest.operations.LocalToKafkaCommand) ManualOperationParams(org.locationtech.geowave.core.cli.parser.ManualOperationParams)

Aggregations

ManualOperationParams (org.locationtech.geowave.core.cli.parser.ManualOperationParams)2 LocalToKafkaCommand (org.locationtech.geowave.core.ingest.operations.LocalToKafkaCommand)2 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)1 File (java.io.File)1 OperationParams (org.locationtech.geowave.core.cli.api.OperationParams)1 IngestFormatPluginOptions (org.locationtech.geowave.core.ingest.operations.options.IngestFormatPluginOptions)1 VoidResponseProtos (org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos)1