Search in sources :

Example 1 with TopicAdminSettings

use of com.google.cloud.pubsub.spi.v1.TopicAdminSettings in project flink by apache.

the class PubsubHelper method getTopicAdminClient.

public TopicAdminClient getTopicAdminClient() throws IOException {
    if (topicClient == null) {
        TopicAdminSettings topicAdminSettings = TopicAdminSettings.newBuilder().setTransportChannelProvider(channelProvider).setCredentialsProvider(EmulatorCredentialsProvider.create()).build();
        topicClient = TopicAdminClient.create(topicAdminSettings);
    }
    return topicClient;
}
Also used : TopicAdminSettings(com.google.cloud.pubsub.v1.TopicAdminSettings)

Example 2 with TopicAdminSettings

use of com.google.cloud.pubsub.spi.v1.TopicAdminSettings in project spring-cloud-gcp by spring-cloud.

the class GcpPubSubEmulatorAutoConfigurationTests method testEmulatorConfig.

@Test
public void testEmulatorConfig() {
    this.contextRunner.run((context) -> {
        CredentialsProvider defaultCredentialsProvider = context.getBean(CredentialsProvider.class);
        assertThat(defaultCredentialsProvider).isNotInstanceOf(NoCredentialsProvider.class);
        TopicAdminSettings topicAdminSettings = context.getBean(TopicAdminSettings.class);
        CredentialsProvider credentialsProvider = topicAdminSettings.getCredentialsProvider();
        assertThat(credentialsProvider).isInstanceOf(NoCredentialsProvider.class);
        TransportChannelProvider transportChannelProvider = context.getBean(TransportChannelProvider.class);
        assertThat(transportChannelProvider).isInstanceOf(FixedTransportChannelProvider.class);
    });
}
Also used : TopicAdminSettings(com.google.cloud.pubsub.v1.TopicAdminSettings) NoCredentialsProvider(com.google.api.gax.core.NoCredentialsProvider) CredentialsProvider(com.google.api.gax.core.CredentialsProvider) FixedTransportChannelProvider(com.google.api.gax.rpc.FixedTransportChannelProvider) TransportChannelProvider(com.google.api.gax.rpc.TransportChannelProvider) Test(org.junit.Test)

Aggregations

TopicAdminSettings (com.google.cloud.pubsub.v1.TopicAdminSettings)2 CredentialsProvider (com.google.api.gax.core.CredentialsProvider)1 NoCredentialsProvider (com.google.api.gax.core.NoCredentialsProvider)1 FixedTransportChannelProvider (com.google.api.gax.rpc.FixedTransportChannelProvider)1 TransportChannelProvider (com.google.api.gax.rpc.TransportChannelProvider)1 Test (org.junit.Test)1