aromanenko-dev commented on a change in pull request #16503:
URL: https://github.com/apache/beam/pull/16503#discussion_r789777932
##########
File path:
sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/sns/SnsIO.java
##########
@@ -370,13 +365,11 @@ private static boolean isTopicExists(SnsClient client,
String topicArn) {
@Override
public PCollection<PublishResponse> expand(PCollection<T> input) {
- checkArgument(getTopicArn() != null, "withTopicArn() is required");
- checkArgument(getPublishRequestFn() != null, "withPublishRequestFn() is
required");
+ checkArgument(getPublishRequestBuilder() != null,
"withPublishRequestBuilder() is required");
Review comment:
I guess it will be a breaking change if it's not set by default since it
didn't exist before.
##########
File path:
sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/sns/SnsIO.java
##########
@@ -418,8 +420,14 @@ public void setup() throws Exception {
@ProcessElement
public void processElement(ProcessContext context) throws Exception {
- PublishRequest request =
- (PublishRequest)
spec.getPublishRequestFn().apply(context.element());
+ PublishRequest.Builder reqBuilder =
Review comment:
Won't it be too expensive to create a new builder for every input
element? Can it be optimised?
##########
File path:
sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/sns/SnsIO.java
##########
@@ -385,6 +378,15 @@ private static boolean isTopicExists(SnsClient client,
String topicArn) {
return result;
}
+ private boolean checkTopicExists() {
+ try (SnsClient client = getSnsClientProvider().getSnsClient()) {
+ client.getTopicAttributes(b -> b.topicArn(getTopicArn()));
+ return true;
+ } catch (NotFoundException | InvalidParameterException e) {
+ return false;
Review comment:
It would be useful to write some message into warn log here.
--
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]