Search in sources :

Example 1 with PushHttpSource

use of io.mantisrx.connector.publish.source.http.PushHttpSource in project mantis by Netflix.

the class PushRequestEventSourceJob method getJobInstance.

@Override
public Job<String> getJobInstance() {
    String jobId = Utils.getEnvVariable("JOB_ID", "PushRequestEventSourceJobLocal-1");
    String mantisClientId = MANTIS_CLIENT_ID + "_" + jobId;
    QueryRegistry queryRegistry = new QueryRegistry.Builder().withClientIdPrefix(mantisClientId).build();
    String customPortName = "MANTIS_WORKER_CUSTOM_PORT";
    String consolePort = Utils.getEnvVariable(customPortName, "9090");
    int port = 9090;
    if (consolePort != null && !consolePort.isEmpty()) {
        port = Integer.parseInt(consolePort);
    }
    return MantisJob.source(new PushHttpSource(queryRegistry, port)).stage(new EchoStage(), EchoStage.config()).sink(new SourceSink(new RequestPreProcessor(queryRegistry), new RequestPostProcessor(queryRegistry), mantisClientId)).parameterDefinition(new IntParameter().name(MantisSourceJobConstants.ECHO_STAGE_BUFFER_MILLIS).description("millis to buffer events before processing").validator(Validators.range(100, 1000)).defaultValue(250).build()).metadata(new Metadata.Builder().name("PushRequestEventSourceJob").description("Fetches request events from any source in a distributed manner. " + "The output is served via HTTP server using SSE protocol.").build()).create();
}
Also used : RequestPreProcessor(io.mantisrx.sourcejobs.publish.core.RequestPreProcessor) RequestPostProcessor(io.mantisrx.sourcejobs.publish.core.RequestPostProcessor) PushHttpSource(io.mantisrx.connector.publish.source.http.PushHttpSource) QueryRegistry(io.mantisrx.connector.publish.core.QueryRegistry) Metadata(io.mantisrx.runtime.Metadata) EchoStage(io.mantisrx.sourcejobs.publish.stages.EchoStage) SourceSink(io.mantisrx.connector.publish.source.http.SourceSink) IntParameter(io.mantisrx.runtime.parameter.type.IntParameter)

Aggregations

QueryRegistry (io.mantisrx.connector.publish.core.QueryRegistry)1 PushHttpSource (io.mantisrx.connector.publish.source.http.PushHttpSource)1 SourceSink (io.mantisrx.connector.publish.source.http.SourceSink)1 Metadata (io.mantisrx.runtime.Metadata)1 IntParameter (io.mantisrx.runtime.parameter.type.IntParameter)1 RequestPostProcessor (io.mantisrx.sourcejobs.publish.core.RequestPostProcessor)1 RequestPreProcessor (io.mantisrx.sourcejobs.publish.core.RequestPreProcessor)1 EchoStage (io.mantisrx.sourcejobs.publish.stages.EchoStage)1