Search in sources :

Example 1 with StorageClientSettings

use of org.apache.bookkeeper.clients.config.StorageClientSettings in project bookkeeper by apache.

the class TestLocationClientImpl method doSetup.

@Override
protected void doSetup() throws Exception {
    StorageClientSettings settings = StorageClientSettings.newBuilder().managedChannelBuilder(InProcessChannelBuilder.forName(serverName).directExecutor()).usePlaintext(true).build();
    locationClient = new LocationClientImpl(settings, scheduler);
    locationServiceDefinition = locationService.bindService();
    serviceRegistry.addService(locationServiceDefinition);
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings)

Example 2 with StorageClientSettings

use of org.apache.bookkeeper.clients.config.StorageClientSettings in project bookkeeper by apache.

the class StreamCluster method createDefaultNamespaces.

private void createDefaultNamespaces() throws Exception {
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(getRpcEndpoints().toArray(new Endpoint[getRpcEndpoints().size()])).usePlaintext(true).build();
    log.info("RpcEndpoints are : {}", settings.endpoints());
    String namespaceName = "default";
    try (StorageAdminClient admin = StorageClientBuilder.newBuilder().withSettings(settings).buildAdmin()) {
        System.out.println("Creating namespace '" + namespaceName + "' ...");
        try {
            NamespaceProperties nsProps = result(admin.createNamespace(namespaceName, NamespaceConfiguration.newBuilder().setDefaultStreamConf(DEFAULT_STREAM_CONF).build()));
            System.out.println("Successfully created namespace '" + namespaceName + "':");
            System.out.println(nsProps);
        } catch (NamespaceExistsException nee) {
            System.out.println("Namespace '" + namespaceName + "' already exists.");
        }
    }
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint) NamespaceProperties(org.apache.bookkeeper.stream.proto.NamespaceProperties) StorageAdminClient(org.apache.bookkeeper.clients.admin.StorageAdminClient) NamespaceExistsException(org.apache.bookkeeper.clients.exceptions.NamespaceExistsException)

Example 3 with StorageClientSettings

use of org.apache.bookkeeper.clients.config.StorageClientSettings in project bookkeeper by apache.

the class StorageAdminClientTest method doSetup.

@Override
protected void doSetup() throws Exception {
    scheduler = OrderedScheduler.newSchedulerBuilder().name("admin-client-test").numThreads(1).build();
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    adminClient = StorageClientBuilder.newBuilder().withSettings(settings).buildAdmin();
    defaultBackendUri = URI.create("distributedlog://" + cluster.getZkServers() + "/stream/storage");
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint)

Example 4 with StorageClientSettings

use of org.apache.bookkeeper.clients.config.StorageClientSettings in project bookkeeper by apache.

the class LocationClientTest method doSetup.

@Override
protected void doSetup() throws Exception {
    scheduler = OrderedScheduler.newSchedulerBuilder().name("location-client-test").numThreads(1).build();
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    client = new LocationClientImpl(settings, scheduler);
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint) LocationClientImpl(org.apache.bookkeeper.clients.impl.internal.LocationClientImpl)

Example 5 with StorageClientSettings

use of org.apache.bookkeeper.clients.config.StorageClientSettings in project bookkeeper by apache.

the class StorageClientTest method doSetup.

@Override
protected void doSetup() throws Exception {
    defaultBackendUri = URI.create("distributedlog://" + cluster.getZkServers() + "/stream/storage");
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    adminClient = StorageClientBuilder.newBuilder().withSettings(settings).buildAdmin();
    nsName = "test_namespace";
    FutureUtils.result(adminClient.createNamespace(nsName, colConf));
    client = StorageClientBuilder.newBuilder().withSettings(settings).withNamespace(nsName).build();
    streamName = "test_stream";
    createStream(streamName);
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint)

Aggregations

StorageClientSettings (org.apache.bookkeeper.clients.config.StorageClientSettings)8 Endpoint (org.apache.bookkeeper.stream.proto.common.Endpoint)6 StorageAdminClient (org.apache.bookkeeper.clients.admin.StorageAdminClient)2 ToString (lombok.ToString)1 NamespaceExistsException (org.apache.bookkeeper.clients.exceptions.NamespaceExistsException)1 NamespaceNotFoundException (org.apache.bookkeeper.clients.exceptions.NamespaceNotFoundException)1 StreamNotFoundException (org.apache.bookkeeper.clients.exceptions.StreamNotFoundException)1 LocationClientImpl (org.apache.bookkeeper.clients.impl.internal.LocationClientImpl)1 NamespaceProperties (org.apache.bookkeeper.stream.proto.NamespaceProperties)1