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

com.rabbitmq.http.client.ReactorNettyClientOptions Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2018-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * 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 com.rabbitmq.http.client;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.buffer.ByteBuf;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClient;

import java.util.function.BiConsumer;
import java.util.function.Supplier;

/**
 * Options for {@link ReactorNettyClient}.
 * An instance of this class can be passed in to {@link ReactorNettyClient}
 * constructor for settings like Jackson JSON object mapper, authentication,
 * TLS, error handling.
 *
 * @see ReactorNettyClient
 * @since 2.1.0
 */
public class ReactorNettyClientOptions {

    private Supplier client;

    private Supplier objectMapper;

    private Mono token;

    private BiConsumer onResponseCallback;

    private Supplier byteBufSupplier;

    public Supplier objectMapper() {
        return objectMapper;
    }

    public ReactorNettyClientOptions objectMapper(Supplier objectMapper) {
        this.objectMapper = objectMapper;
        return this;
    }

    public Mono token() {
        return token;
    }

    public ReactorNettyClientOptions token(Mono token) {
        this.token = token;
        return this;
    }

    public ReactorNettyClientOptions onResponseCallback(
        BiConsumer onResponseCallback) {
        this.onResponseCallback = onResponseCallback;
        return this;
    }

    public BiConsumer onResponseCallback() {
        return onResponseCallback;
    }

    public Supplier client() {
        return client;
    }

    public ReactorNettyClientOptions client(Supplier client) {
        this.client = client;
        return this;
    }

    public ReactorNettyClientOptions byteBufSupplier(Supplier byteBufSupplier) {
        this.byteBufSupplier = byteBufSupplier;
        return this;
    }

    public Supplier byteBufSupplier() {
        return this.byteBufSupplier;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy