Skip to content

Conversation

derrickaw
Copy link

Description

  1. Adds more information about sending Kafka messages and environment variables setup if required.
  2. Fixes url to kafka image location.

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: dataflow Issues related to the Dataflow API. labels Sep 15, 2025
@derrickaw derrickaw marked this pull request as ready for review September 15, 2025 14:55
@derrickaw derrickaw requested review from yoshi-approver and a team as code owners September 15, 2025 14:55
@@ -200,6 +212,41 @@ gcloud compute instances create-with-container kafka-vm \
--tags "kafka-server"
```
### Sending messages to Kafka server
The Kafka server should be running at this point, but in its current state no
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: blending in context with instruction to ssh makes this a little difficult to parse.

the template is started will be present when the template is started. If the
desire is to send messages after the template has started, then the messages
will be processed as they are sent.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd restructure the following menu of items into a recipe to follow. (deletion probably at the bottom)

Copy link
Contributor

@iennae iennae Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested ordering:

Pre-Req SSH into the Kafka VM

$ gcloud compute ssh kafka-vm --zone "$ZONE"

1. Create a Topic

Replace with your topic ID.

(show docker command)

2. Send Messages to the Topic

Run the console producer to send messages. After running the command, type a message and press Enter. You can send multiple messages. Press Ctrl+C to stop the producer.

Note: You can run this step either before starting the Dataflow template (messages will be ready) or while it's running (messages will be processed as they arrive).

(show docker command)

3. (Optional) Verify the Messages

You can check that your messages were sent correctly by starting a consumer. This will print all messages from the beginning of the topic. Press Ctrl+C to exit.

4. (Optional) Delete a Topic

@@ -183,9 +183,21 @@ To learn more about pricing, see the
```sh
export KAFKA_IMAGE="gcr.io/$PROJECT/samples/dataflow/kafka:latest"
# Note: If the project name has `:` in it that signifies a project within an
# organization (e.g. `example.com:project-id`), replace those with `/` so that
# the Kafa image can be found appropriately.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/Kafa/Kafka

@@ -33,7 +33,7 @@ ENV ZOOKEEPER_PORT="${ZOOKEEPER_PORT:-2181}"

# Download and install Apache Kafka.
RUN apk add --no-cache bash \
&& wget http://apache.mirrors.spacedump.net/kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz \
&& wget http://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should use the https:// here

Copy link
Contributor

@iennae iennae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of nits and some suggestions but not blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: dataflow Issues related to the Dataflow API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants