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

reactor.net.NetClient Maven / Gradle / Ivy

The newest version!
package reactor.net;

import reactor.core.composable.Promise;
import reactor.core.composable.Stream;
import reactor.function.Consumer;

/**
 * A network-aware client.
 *
 * @author Jon Brisbin
 */
public interface NetClient extends Iterable> {

	/**
	 * Open a channel to the configured address and return a {@link reactor.core.composable.Promise} that will be
	 * fulfilled with the connected {@link reactor.net.NetChannel}.
	 *
	 * @return {@link reactor.core.composable.Promise} that will be completed when connected
	 */
	Promise> open();

	/**
	 * Open a channel to the configured address and return a {@link reactor.core.composable.Stream} that will be populated
	 * by the {@link reactor.net.NetChannel NetChannels} every time a connection or reconnection is made.
	 *
	 * @param reconnect
	 * 		the reconnection strategy to use when disconnects happen
	 *
	 * @return
	 */
	Stream> open(Reconnect reconnect);

	/**
	 * Close this client and the underlying channel.
	 */
	Promise close();

	/**
	 * Close this client and the underlying channel and invoke the given {@link reactor.function.Consumer} when the
	 * operation has completed.
	 *
	 * @param onClose
	 * 		consumer to invoke when client is closed
	 */
	void close(Consumer onClose);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy