mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-24 15:00:43 +02:00
* 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.
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
- SeaweedMQ Running: Make sure SeaweedMQ is running on
localhost:17777(default Kafka port) - 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:
isSystemTopic()function identifies "_" prefix topics as system topicsproduceSchemaBasedRecord()bypasses schema processing for system topics- 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