sjvanrossum commented on code in PR #31608:
URL: https://github.com/apache/beam/pull/31608#discussion_r1642942781
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java:
##########
@@ -735,6 +735,20 @@ public static Write<PubsubMessage> writeMessages() {
.build();
}
+ /**
+ * Returns A {@link PTransform} that writes {@link PubsubMessage}s, along
with the {@link
+ * PubsubMessage#getMessageId() messageId} and {@link
PubsubMessage#getOrderingKey()}, to a Google
+ * Cloud Pub/Sub stream.
+ */
+ public static Write<PubsubMessage> writeMessagesWithOrderingKey() {
+ return Write.newBuilder()
+ .setTopicProvider(null)
+ .setTopicFunction(null)
+ .setDynamicDestinations(false)
+ .setNeedsOrderingKey(true)
+ .build();
+ }
+
Review Comment:
A non-static method `withOrderingKey()` should be fine since this can
function independent of dynamic destinations.
It would have no effect to call that method on a `Write` constructed using
`writeStrings()`, `writeProtos()` or `writeAvros()`, but that's also the case
for `withTimestampAttribute()` and `withIdAttribute()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]