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

com.hazelcast.jet.elastic.impl.ElasticSourceConfiguration Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
/*
 * Copyright 2023 Hazelcast Inc.
 *
 * Licensed under the Hazelcast Community License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://hazelcast.com/hazelcast-community-license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hazelcast.jet.elastic.impl;

import com.hazelcast.function.FunctionEx;
import com.hazelcast.function.SupplierEx;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.search.SearchHit;

import javax.annotation.Nonnull;
import java.io.Serializable;

/**
 * Configuration for the Elastic source which is Serializable
 *
 * Avoids passing multiple parameters via constructors
 * Builder -> ElasticSourcePMetaSupplier -> ElasticSourcePSupplier
 * -> ElasticSourceP -> ElasticScrollTraverser
 */
public class ElasticSourceConfiguration implements Serializable {

    private static final long serialVersionUID = 1L;

    private final SupplierEx clientFn;
    private final SupplierEx searchRequestFn;
    private final FunctionEx optionsFn;
    private final FunctionEx mapToItemFn;
    private final boolean slicing;
    private final boolean coLocatedReading;
    private final String scrollKeepAlive;
    private final int retries;

    public ElasticSourceConfiguration(
            SupplierEx clientFn,
            SupplierEx searchRequestFn,
            FunctionEx optionsFn,
            FunctionEx mapToItemFn,
            boolean slicing, boolean coLocatedReading,
            String scrollKeepAlive, int retries
    ) {
        this.clientFn = clientFn;
        this.searchRequestFn = searchRequestFn;
        this.optionsFn = optionsFn;
        this.mapToItemFn = mapToItemFn;
        this.slicing = slicing;
        this.coLocatedReading = coLocatedReading;
        this.scrollKeepAlive = scrollKeepAlive;
        this.retries = retries;
    }

    @Nonnull
    public SupplierEx clientFn() {
        return clientFn;
    }

    @Nonnull
    public SupplierEx searchRequestFn() {
        return searchRequestFn;
    }

    @Nonnull
    public FunctionEx mapToItemFn() {
        return mapToItemFn;
    }

    public FunctionEx optionsFn() {
        return optionsFn;
    }

    public boolean isSlicingEnabled() {
        return slicing;
    }

    public boolean isCoLocatedReadingEnabled() {
        return coLocatedReading;
    }

    public String scrollKeepAlive() {
        return scrollKeepAlive;
    }

    public int retries() {
        return retries;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy