Files
seaweedfs/test/kafka/simple-publisher
Chris Lu f08f075d23 deps: patch two open dependabot alerts (klauspost/compress, aws-smithy-json) (#11959)
* test/kafka: bump klauspost/compress to v1.20.3 in simple-publisher

Patch an s2 integer-overflow / out-of-bounds write affecting
klauspost/compress <= 1.18.6; matches the version the main module
already uses. The go directive rises to 1.25, still under the ^1.26
toolchain the kafka test workflows run with.

* seaweed-volume: bump aws-smithy-json to 0.62.7

Patch an uncontrolled-recursion denial of service in the unknown-key
skip path of aws-smithy-json <= 0.62.6 (reachable over the S3 SDK's
response parsing). The smithy runtime family moves together:
aws-smithy-runtime-api 1.12.3 and aws-smithy-types 1.5.0, all selected
within the workspace's Rust 1.91.1 compatibility bound.
2026-10-22 14:38:16 -07:00
..
2025-10-13 18:05:17 -07:00
2025-10-13 18:05:17 -07:00
2025-10-13 18:05:17 -07:00

Simple Kafka-Go Publisher for SeaweedMQ

This is a simple publisher client that demonstrates publishing raw messages to SeaweedMQ topics with "_" prefix, which bypass schema validation.

Features

  • Schema-Free Publishing: Topics with "_" prefix don't require schema validation
  • Raw Message Storage: Messages are stored in a "value" field as raw bytes
  • Multiple Message Formats: Supports JSON, binary, and empty messages
  • Kafka-Go Compatible: Uses the popular kafka-go library

Prerequisites

  1. SeaweedMQ Running: Make sure SeaweedMQ is running on localhost:17777 (default Kafka port)
  2. Go Modules: The project uses Go modules for dependency management

Setup and Run

# Navigate to the publisher directory
cd test/kafka/simple-publisher

# Download dependencies
go mod tidy

# Run the publisher
go run main.go

Expected Output

Publishing messages to topic '_raw_messages' on broker 'localhost:17777'
Publishing messages...
- Published message 1: {"id":1,"message":"Hello from kafka-go client",...}
- Published message 2: {"id":2,"message":"Raw message without schema validation",...}
- Published message 3: {"id":3,"message":"Testing SMQ with underscore prefix topic",...}

Publishing different raw message formats...
- Published raw message 1: key=binary_key, value=Simple string message
- Published raw message 2: key=json_key, value={"raw_field": "raw_value", "number": 42}
- Published raw message 3: key=empty_key, value=
- Published raw message 4: key=, value=Message with no key

All test messages published to topic with '_' prefix!
These messages should be stored as raw bytes without schema validation.

Topic Naming Convention

  • Schema-Required Topics: user-events, orders, payments (require schema validation)
  • Schema-Free Topics: _raw_messages, _logs, _metrics (bypass schema validation)

The "_" prefix tells SeaweedMQ to treat the topic as a system topic and skip schema processing entirely.

Message Storage

For topics with "_" prefix:

  • Messages are stored as raw bytes without schema validation
  • No Confluent Schema Registry envelope is required
  • Any binary data or text can be published
  • SMQ assumes raw messages are stored in a "value" field internally

Integration with SeaweedMQ

This client works with SeaweedMQ's existing schema bypass logic:

  1. isSystemTopic() function identifies "_" prefix topics as system topics
  2. produceSchemaBasedRecord() bypasses schema processing for system topics
  3. Raw storage via seaweedMQHandler.ProduceRecord() stores messages as-is

Use Cases

  • Log ingestion: Store application logs without predefined schema
  • Metrics collection: Publish time-series data in various formats
  • Raw data pipelines: Process unstructured data before applying schemas
  • Development/testing: Quickly publish test data without schema setup