Java Code Examples for io.rsocket.RSocketFactory#ClientRSocketFactory

The following examples show how to use io.rsocket.RSocketFactory#ClientRSocketFactory . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Rsc.java    From rsc with Apache License 2.0 6 votes vote down vote up
static Flux<?> run(Args args) {
	if (args.debug()) {
		configureDebugLevel("io.rsocket.FrameLogger");
	}
	args.log().ifPresent(Rsc::configureDebugLevel);
	final ClientTransport clientTransport = args.clientTransport();
	final RSocketFactory.ClientRSocketFactory factory = RSocketFactory.connect();
	args.resume().ifPresent(duration -> factory.resume().resumeSessionDuration(duration)
			.resumeStrategy(() -> new PeriodicResumeStrategy(Duration.ofSeconds(5))));
	args.setup().map(DefaultPayload::create).ifPresent(factory::setupPayload);
	return factory //
			.frameDecoder(PayloadDecoder.ZERO_COPY) //
			.metadataMimeType(args.composeMetadata().getT1()) //
			.dataMimeType(args.dataMimeType()) //
			.transport(clientTransport) //
			.start() //
			.flatMapMany(rsocket -> args.interactionModel().request(rsocket, args));
}
 
Example 2
Source File: DefaultRSocketRequesterBuilderTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void shouldApplyCustomizationsAtSubscription() {
	Consumer<RSocketFactory.ClientRSocketFactory> factoryConfigurer = mock(Consumer.class);
	Consumer<RSocketStrategies.Builder> strategiesConfigurer = mock(Consumer.class);
	RSocketRequester.builder()
			.rsocketFactory(factoryConfigurer)
			.rsocketStrategies(strategiesConfigurer)
			.connect(this.transport);
	verifyZeroInteractions(this.transport, factoryConfigurer, strategiesConfigurer);
}
 
Example 3
Source File: DefaultRSocketRequesterBuilderTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void shouldApplyCustomizations() {
	Consumer<RSocketFactory.ClientRSocketFactory> factoryConfigurer = mock(Consumer.class);
	Consumer<RSocketStrategies.Builder> strategiesConfigurer = mock(Consumer.class);
	RSocketRequester.builder()
			.rsocketFactory(factoryConfigurer)
			.rsocketStrategies(strategiesConfigurer)
			.connect(this.transport)
			.block();
	verify(this.transport).connect(anyInt());
	verify(factoryConfigurer).accept(any(RSocketFactory.ClientRSocketFactory.class));
	verify(strategiesConfigurer).accept(any(RSocketStrategies.Builder.class));
}
 
Example 4
Source File: DefaultRSocketRequesterBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public RSocketRequester.Builder rsocketFactory(Consumer<RSocketFactory.ClientRSocketFactory> configurer) {
	this.factoryConfigurers.add(configurer);
	return this;
}
 
Example 5
Source File: RSocketRequester.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Configure the {@code ClientRSocketFactory}.
 * <p>Note there is typically no need to set a data MimeType explicitly.
 * By default a data MimeType is picked by taking the first concrete
 * MimeType supported by the configured encoders and decoders.
 * @param configurer the configurer to apply
 */
RSocketRequester.Builder rsocketFactory(Consumer<RSocketFactory.ClientRSocketFactory> configurer);