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

com.quorum.tessera.p2p.recovery.RecoveryClientProvider Maven / Gradle / Ivy

package com.quorum.tessera.p2p.recovery;

import com.quorum.tessera.config.Config;
import com.quorum.tessera.config.ConfigFactory;
import com.quorum.tessera.config.ServerConfig;
import com.quorum.tessera.config.util.IntervalPropertyHelper;
import com.quorum.tessera.jaxrs.client.ClientFactory;
import com.quorum.tessera.ssl.context.ClientSSLContextFactory;
import com.quorum.tessera.ssl.context.SSLContextFactory;
import jakarta.ws.rs.client.Client;
import java.util.Map;

public class RecoveryClientProvider {

  public static RecoveryClient provider() {

    final Config config = ConfigFactory.create().getConfig();
    final ServerConfig serverConfig = config.getP2PServerConfig();

    final Map properties = serverConfig.getProperties();

    final String waitTime = new IntervalPropertyHelper(properties).resendWaitTime();

    final SSLContextFactory clientSSLContextFactory = ClientSSLContextFactory.create();

    final ClientFactory clientFactory = new ClientFactory(clientSSLContextFactory);
    final Client client = clientFactory.buildFrom(config.getP2PServerConfig());

    client.property("jersey.config.client.readTimeout", waitTime);
    return new RestRecoveryClient(client);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy