@Bean @ConditionalOnMissingBean public SubscriptionAdminClient subscriptionAdminClient( TransportChannelProvider transportChannelProvider) { try { return SubscriptionAdminClient.create( SubscriptionAdminSettings.newBuilder() .setCredentialsProvider(this.finalCredentialsProvider) .setHeaderProvider(this.headerProvider) .setTransportChannelProvider(transportChannelProvider) .build()); } catch (IOException ioe) { throw new PubSubException("An error occurred while creating SubscriptionAdminClient.", ioe); } }
/** * This constructor instantiates TopicAdminClient and SubscriptionAdminClient with all their * defaults and the provided credentials provider. * @param projectIdProvider the project id provider to use * @param credentialsProvider the credentials provider to use * @throws IOException thrown when there are errors in contacting Google Cloud Pub/Sub */ public PubSubAdmin(GcpProjectIdProvider projectIdProvider, CredentialsProvider credentialsProvider) throws IOException { this(projectIdProvider, TopicAdminClient.create( TopicAdminSettings.newBuilder() .setCredentialsProvider(credentialsProvider) .build()), SubscriptionAdminClient.create( SubscriptionAdminSettings.newBuilder() .setCredentialsProvider(credentialsProvider) .build())); }
/** * This constructor instantiates TopicAdminClient and SubscriptionAdminClient with all their * defaults and the provided credentials provider. * @param projectIdProvider the project id provider to use * @param credentialsProvider the credentials provider to use * @throws IOException thrown when there are errors in contacting Google Cloud Pub/Sub */ public PubSubAdmin(GcpProjectIdProvider projectIdProvider, CredentialsProvider credentialsProvider) throws IOException { this(projectIdProvider, TopicAdminClient.create( TopicAdminSettings.newBuilder() .setCredentialsProvider(credentialsProvider) .build()), SubscriptionAdminClient.create( SubscriptionAdminSettings.newBuilder() .setCredentialsProvider(credentialsProvider) .build())); }
public static final SubscriptionAdminSettings create(SubscriberStubSettings stub) throws IOException { return new SubscriptionAdminSettings.Builder(stub.toBuilder()).build(); }
/** Constructs an instance of SubscriptionAdminClient with default settings. */ public static final SubscriptionAdminClient create() throws IOException { return create(SubscriptionAdminSettings.newBuilder().build()); }
@Before public void setUp() throws IOException { serviceHelper.reset(); channelProvider = serviceHelper.createChannelProvider(); SubscriptionAdminSettings settings = SubscriptionAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) .setCredentialsProvider(NoCredentialsProvider.create()) .build(); client = SubscriptionAdminClient.create(settings); }