@Experimental public final class PubsubLiteIO extends java.lang.Object
For the differences between this and Google Pub/Sub, please refer to the product documentation.
Modifier and Type | Method and Description |
---|---|
static PTransform<PCollection<com.google.cloud.pubsublite.proto.PubSubMessage>,PCollection<com.google.cloud.pubsublite.proto.PubSubMessage>> |
addUuids()
Add Uuids to to-be-published messages that ensures that uniqueness is maintained.
|
static PTransform<PCollection<com.google.cloud.pubsublite.proto.SequencedMessage>,PCollection<com.google.cloud.pubsublite.proto.SequencedMessage>> |
deduplicate(UuidDeduplicationOptions options)
Remove duplicates from the PTransform from a read.
|
static PTransform<PBegin,PCollection<com.google.cloud.pubsublite.proto.SequencedMessage>> |
read(SubscriberOptions options)
Read messages from Pub/Sub Lite.
|
static PTransform<PCollection<com.google.cloud.pubsublite.proto.PubSubMessage>,PDone> |
write(PublisherOptions options)
Write messages to Pub/Sub Lite.
|
public static PTransform<PBegin,PCollection<com.google.cloud.pubsublite.proto.SequencedMessage>> read(SubscriberOptions options)
Note that this will not pick up newly added partitions. To pick up new partitions, drain and restart the pipeline.
Pipeline p = ...;
SubscriptionPath subscriptionPath =
SubscriptionPath.newBuilder()
.setLocation(zone)
.setProjectNumber(projectNum)
.setName(subscriptionName)
.build();
PCollection<SequencedMessage> messages = p.apply(PubsubLiteIO.read(SubscriberOptions.newBuilder()
.setSubscriptionPath(subscriptionPath)
.build()), "read");
public static PTransform<PCollection<com.google.cloud.pubsublite.proto.SequencedMessage>,PCollection<com.google.cloud.pubsublite.proto.SequencedMessage>> deduplicate(UuidDeduplicationOptions options)
PCollection<SequencedMessage> messages = ... (above) ...;
messages = messages.apply(PubsubLiteIO.deduplicate(
UuidDeduplicationOptions.newBuilder().build()));
public static PTransform<PCollection<com.google.cloud.pubsublite.proto.PubSubMessage>,PCollection<com.google.cloud.pubsublite.proto.PubSubMessage>> addUuids()
PCollection<Message> messages = ...;
messages = messages.apply(PubsubLiteIO.addUuids());
public static PTransform<PCollection<com.google.cloud.pubsublite.proto.PubSubMessage>,PDone> write(PublisherOptions options)
TopicPath topicPath =
TopicPath.newBuilder()
.setProjectNumber(projectNum)
.setLocation(zone)
.setName(topicName)
.build();
PCollection<Message> messages = ...;
messages.apply(PubsubLiteIO.write(
PublisherOptions.newBuilder().setTopicPath(topicPath).build());