All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nstream.adapter.common.ext.HttpIngressSettings Maven / Gradle / Ivy

There is a newer version: 4.14.22
Show newest version
// Copyright 2015-2024 Nstream, inc.
//
// Licensed under the Redis Source Available License 2.0 (RSALv2) Agreement;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://redis.com/legal/rsalv2-agreement/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package nstream.adapter.common.ext;

import java.util.Map;
import nstream.adapter.common.AdapterSettings;
import swim.codec.Format;
import swim.codec.Output;
import swim.structure.Form;
import swim.structure.Kind;
import swim.structure.Tag;
import swim.structure.Value;

@Tag("httpIngressSettings")
public class HttpIngressSettings implements AdapterSettings {

  private static final HttpIngressSettings DEFAULT = new HttpIngressSettings();

  private final long firstPollDelayMillis;
  private final long timeoutMillis;
  private final long pollIntervalMillis;
  private final Map headers;
  private final String contentEncodingOverride;
  private final String contentTypeOverride;
  // private final Value contentMolderSchema;
  private final String endpointUrl;
  private final Value relaySchema;

  public HttpIngressSettings(long firstPollDelayMillis, long timeoutMillis, long pollIntervalMillis,
                             Map headers, String contentEncodingOverride,
                             String contentTypeOverride, /*Value contentMolderSchema,*/
                             String endpointUrl, Value relaySchema) {
    this.firstPollDelayMillis = firstPollDelayMillis;
    this.timeoutMillis = timeoutMillis;
    this.pollIntervalMillis = pollIntervalMillis;
    this.headers = headers;
    this.contentEncodingOverride = contentEncodingOverride;
    this.contentTypeOverride = contentTypeOverride;
    // this.contentMolderSchema = contentMolderSchema;
    this.endpointUrl = endpointUrl;
    this.relaySchema = relaySchema;
  }

  public long firstPollDelayMillis() {
    return this.firstPollDelayMillis;
  }

  public long timeoutMillis() {
    return this.timeoutMillis;
  }

  public long pollIntervalMillis() {
    return this.pollIntervalMillis;
  }

  public Map headers() {
    return this.headers;
  }

  public String contentEncodingOverride() {
    return this.contentEncodingOverride;
  }

  public String contentTypeOverride() {
    return this.contentTypeOverride;
  }

  // public Value contentMolderOverride() {
  //   return this.contentMolderSchema;
  // }

  public String endpointUrl() {
    return this.endpointUrl;
  }

  public Value relaySchema() {
    return this.relaySchema;
  }

  public HttpIngressSettings() {
    this(2000L, 10000L, 10000L, null, null, null, /*null,*/ null, null);
  }

  @Override
  public  Output debug(Output output) {
    output = output.write("HttpIngressSettings").write('.').write("of").write('(').write(')')
        .write('.').write("firstPollDelayMillis").write('(').debug(this.firstPollDelayMillis).write(')')
        .write('.').write("timeoutMillis").write('(').debug(this.timeoutMillis).write(')')
        .write('.').write("pollIntervalMillis").write('(').debug(this.pollIntervalMillis).write(')')
        .write('.').write("headers").write('(').debug(this.headers).write(')')
        .write('.').write("contentEncodingOverride").write('(').debug(this.contentEncodingOverride).write(')')
        .write('.').write("contentTypeOverride").write('(').debug(this.contentTypeOverride).write(')')
        // .write('.').write("contentMolderSchema").write('(').debug(this.contentMolderSchema).write(')')
        .write('.').write("endpointUrl").write('(').debug(this.endpointUrl).write(')')
        .write('.').write("relaySchema").write('(').debug(this.relaySchema).write(')');
    return output;
  }

  @Override
  public String toString() {
    return Format.debug(this);
  }

  @Kind
  private static Form form;

  public static Form form() {
    if (HttpIngressSettings.form == null) {
      HttpIngressSettings.form = Form.forClass(HttpIngressSettings.class);
    }
    return HttpIngressSettings.form;
  }

  public static HttpIngressSettings defaultSettings() {
    return DEFAULT;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy