use of com.couchbase.client.core.service.EventingService in project couchbase-jvm-clients by couchbase.
the class Node method createService.
/**
* Helper method to create the {@link Service} based on the service type provided.
*
* @param serviceType the type of service to create.
* @param port the port for that service.
* @param bucket optionally the bucket name.
* @return a created service, but not yet connected or anything.
*/
protected Service createService(final ServiceType serviceType, final int port, final Optional<String> bucket) {
CoreEnvironment env = ctx.environment();
String address = alternateAddress.orElseGet(identifier::address);
switch(serviceType) {
case KV:
return new KeyValueService(KeyValueServiceConfig.endpoints(env.ioConfig().numKvConnections()).build(), ctx, address, port, bucket, authenticator);
case MANAGER:
return new ManagerService(ctx, address, port);
case QUERY:
return new QueryService(QueryServiceConfig.maxEndpoints(env.ioConfig().maxHttpConnections()).idleTime(env.ioConfig().idleHttpConnectionTimeout()).build(), ctx, address, port);
case VIEWS:
return new ViewService(ViewServiceConfig.maxEndpoints(env.ioConfig().maxHttpConnections()).idleTime(env.ioConfig().idleHttpConnectionTimeout()).build(), ctx, address, port);
case SEARCH:
return new SearchService(SearchServiceConfig.maxEndpoints(env.ioConfig().maxHttpConnections()).idleTime(env.ioConfig().idleHttpConnectionTimeout()).build(), ctx, address, port);
case ANALYTICS:
return new AnalyticsService(AnalyticsServiceConfig.maxEndpoints(env.ioConfig().maxHttpConnections()).idleTime(env.ioConfig().idleHttpConnectionTimeout()).build(), ctx, address, port);
case EVENTING:
return new EventingService(ctx, address, port);
case BACKUP:
return new BackupService(ctx, address, port);
default:
throw InvalidArgumentException.fromMessage("Unsupported ServiceType: " + serviceType);
}
}
Aggregations