pubsubFactory.newClient( timestampAttribute, idAttribute, options.as(PubsubOptions.class))) { SubscriptionPath subscriptionPath =
pubsubClient = new AtomicReference<>( outer.outer.pubsubFactory.newClient( outer.outer.timestampAttribute, outer.outer.idAttribute, options)); ackTimeoutMs = -1;
private void initializePubsub(Description description) throws IOException { pubsub = PubsubGrpcClient.FACTORY.newClient( NO_TIMESTAMP_ATTRIBUTE, NO_ID_ATTRIBUTE, pipelineOptions); // Example topic name: // integ-test-TestClassName-testMethodName-2018-12-11-23-32-333-<random-long>-result TopicPath resultTopicPathTmp = PubsubClient.topicPathFromName( pipelineOptions.getProject(), createTopicName(description, RESULT_TOPIC_NAME)); TopicPath startTopicPathTmp = PubsubClient.topicPathFromName( pipelineOptions.getProject(), createTopicName(description, START_TOPIC_NAME)); pubsub.createTopic(resultTopicPathTmp); pubsub.createTopic(startTopicPathTmp); // Set these after successful creation; this signals that they need teardown resultTopicPath = resultTopicPathTmp; startTopicPath = startTopicPathTmp; }
@StartBundle public void startBundle(StartBundleContext c) throws Exception { checkState(pubsubClient == null, "startBundle invoked without prior finishBundle"); pubsubClient = pubsubFactory.newClient( timestampAttribute, idAttribute, c.getPipelineOptions().as(PubsubOptions.class)); }
private void initializePubsub(Description description) throws IOException { pubsub = PubsubGrpcClient.FACTORY.newClient( NO_TIMESTAMP_ATTRIBUTE, NO_ID_ATTRIBUTE, pipelineOptions); TopicPath eventsTopicPathTmp = PubsubClient.topicPathFromName( pipelineOptions.getProject(), createTopicName(description, EVENTS_TOPIC_NAME)); pubsub.createTopic(eventsTopicPathTmp); eventsTopicPath = eventsTopicPathTmp; }
@Override public void populateDisplayData(Builder builder) { super.populateDisplayData(builder); builder.add(DisplayData.item("topic", topic)); builder.add(DisplayData.item("transport", pubsubFactory.getKind())); builder.addIfNotNull(DisplayData.item("timestampAttribute", timestampAttribute)); builder.addIfNotNull(DisplayData.item("idAttribute", idAttribute)); } }
private PubsubClient getClient() throws IOException { if (client == null) { client = PubsubJsonClient.FACTORY.newClient(null, null, options.as(PubsubOptions.class)); } return client; }
@Override public void populateDisplayData(Builder builder) { super.populateDisplayData(builder); builder .addIfNotNull(DisplayData.item("subscription", subscription)) .addIfNotNull(DisplayData.item("topic", topic)) .add(DisplayData.item("transport", pubsubFactory.getKind())) .addIfNotNull(DisplayData.item("timestampAttribute", timestampAttribute)) .addIfNotNull(DisplayData.item("idAttribute", idAttribute)); } }