Esempio n. 1
0
  @JsonCreator
  public RealtimeIndexTask(
      @JsonProperty("id") String id,
      @JsonProperty("resource") TaskResource taskResource,
      @JsonProperty("schema") Schema schema,
      @JsonProperty("firehose") FirehoseFactory firehoseFactory,
      @JsonProperty("fireDepartmentConfig") FireDepartmentConfig fireDepartmentConfig,
      @JsonProperty("windowPeriod") Period windowPeriod,
      @JsonProperty("maxPendingPersists") Integer maxPendingPersists,
      @JsonProperty("segmentGranularity") IndexGranularity segmentGranularity,
      @JsonProperty("rejectionPolicy") RejectionPolicyFactory rejectionPolicyFactory) {
    super(
        id == null
            ? makeTaskId(
                schema.getDataSource(),
                schema.getShardSpec().getPartitionNum(),
                new DateTime().toString())
            : id,
        String.format("index_realtime_%s", schema.getDataSource()),
        taskResource == null
            ? new TaskResource(
                makeTaskId(
                    schema.getDataSource(),
                    schema.getShardSpec().getPartitionNum(),
                    new DateTime().toString()),
                1)
            : taskResource,
        schema.getDataSource());

    this.schema = schema;
    this.firehoseFactory = firehoseFactory;
    this.fireDepartmentConfig = fireDepartmentConfig;
    this.windowPeriod = windowPeriod;
    this.maxPendingPersists =
        (maxPendingPersists == null)
            ? RealtimePlumberSchool.DEFAULT_MAX_PENDING_PERSISTS
            : maxPendingPersists;
    this.segmentGranularity = segmentGranularity;
    this.rejectionPolicyFactory = rejectionPolicyFactory;
  }