io.contek.zeus.client.grpc.GrpcClient Maven / Gradle / Ivy
package io.contek.zeus.client.grpc;
import io.contek.zeus.AccountName;
import io.contek.zeus.ExchangeId;
import io.contek.zeus.client.Client;
import io.contek.zeus.client.IMarketClient;
import io.contek.zeus.client.IUserClient;
import io.grpc.Channel;
import javax.annotation.concurrent.ThreadSafe;
import java.util.Collection;
@ThreadSafe
public final class GrpcClient extends Client {
private final MarketServiceStubPool market;
private final UserServiceStubPool user;
private GrpcClient(
ExchangeId exchangeId, MarketServiceStubPool market, UserServiceStubPool user) {
super(exchangeId);
this.market = market;
this.user = user;
}
public static GrpcClient fromChannel(ExchangeId exchangeId, Collection channels) {
return new GrpcClient(
exchangeId,
MarketServiceStubPool.forChannels(channels),
UserServiceStubPool.forChannels(channels));
}
@Override
public IMarketClient market() {
return new GrpcMarketClient(market);
}
@Override
public IUserClient user(AccountName accountName) {
return new GrpcUserClient(accountName, user.forAccount(accountName));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy