Class PubSubSink.PubSubSinkBuilder<IN>
- java.lang.Object
-
- org.apache.flink.streaming.connectors.gcp.pubsub.PubSubSink.PubSubSinkBuilder<IN>
-
- Type Parameters:
IN- Type of PubSubSink to create.
- All Implemented Interfaces:
PubSubSink.ProjectNameBuilder<IN>,PubSubSink.TopicNameBuilder<IN>
- Enclosing class:
- PubSubSink<IN>
public static class PubSubSink.PubSubSinkBuilder<IN> extends Object implements PubSubSink.ProjectNameBuilder<IN>, PubSubSink.TopicNameBuilder<IN>
PubSubSinkBuilder to create a PubSubSink.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PubSubSink<IN>build()Actually builder the desired instance of the PubSubSink.PubSubSink.PubSubSinkBuilder<IN>withCredentials(com.google.auth.Credentials credentials)Set the credentials.PubSubSink.PubSubSinkBuilder<IN>withHostAndPortForEmulator(String hostAndPort)Set the custom hostname/port combination of PubSub.PubSubSink.TopicNameBuilder<IN>withProjectName(String projectName)Set the project name of the subscription to pull messages from.PubSubSink.PubSubSinkBuilder<IN>withTopicName(String topicName)Set the subscription name of the subscription to pull messages from.
-
-
-
Method Detail
-
withCredentials
public PubSubSink.PubSubSinkBuilder<IN> withCredentials(com.google.auth.Credentials credentials)
Set the credentials. If this is not used then the credentials are picked up from the environment variables.- Parameters:
credentials- the Credentials needed to connect.- Returns:
- The current PubSubSinkBuilder instance
-
withProjectName
public PubSubSink.TopicNameBuilder<IN> withProjectName(String projectName)
Description copied from interface:PubSubSink.ProjectNameBuilderSet the project name of the subscription to pull messages from.- Specified by:
withProjectNamein interfacePubSubSink.ProjectNameBuilder<IN>
-
withTopicName
public PubSubSink.PubSubSinkBuilder<IN> withTopicName(String topicName)
Description copied from interface:PubSubSink.TopicNameBuilderSet the subscription name of the subscription to pull messages from.- Specified by:
withTopicNamein interfacePubSubSink.TopicNameBuilder<IN>
-
withHostAndPortForEmulator
public PubSubSink.PubSubSinkBuilder<IN> withHostAndPortForEmulator(String hostAndPort)
Set the custom hostname/port combination of PubSub. The ONLY reason to use this is during tests with the emulator provided by Google.- Parameters:
hostAndPort- The combination of hostname and port to connect to ("hostname:1234")- Returns:
- The current PubSubSinkBuilder instance
-
build
public PubSubSink<IN> build() throws IOException
Actually builder the desired instance of the PubSubSink.- Returns:
- a brand new PubSubSink
- Throws:
IOException- in case of a problem getting the credentialsIllegalArgumentException- in case required fields were not specified.
-
-