use of io.scalecube.services.transport.api.ClientChannel in project scalecube by scalecube.
the class RSocketClientTransport method create.
@Override
public ClientChannel create(ServiceReference serviceReference) {
// keep reference for threadsafety
final Map<Address, Mono<RSocket>> monoMap = rsockets.get();
final Address address = serviceReference.address();
Mono<RSocket> mono = monoMap.computeIfAbsent(address, key -> getCredentials(serviceReference).flatMap(creds -> connect(key, creds, monoMap)).cache().doOnError(ex -> monoMap.remove(key)));
return new RSocketClientChannel(mono, new ServiceMessageCodec(headersCodec, dataCodecs));
}
Aggregations