Skip to content

Conversation

@abolfazl-alemi-aa
Copy link
Collaborator

Summary

This PR introduces three new packages to the std library: Kafka, Redis, and Schema Registry. All packages follow the established patterns in the library and include comprehensive testing with testcontainers.

Changes Overview

📦 New Packages

1. Kafka (v1/kafka)

  • Complete Kafka client with producer and consumer support
  • Multiple serialization formats (JSON, String, Gob, Protobuf, NoOp, MultiFormat)
  • Schema Registry integration for Avro serialization
  • Comprehensive error handling with retryable/permanent error classification
  • TLS/SASL authentication support
  • Uber FX module for dependency injection

2. Redis (v1/redis)

  • Full-featured Redis client supporting Standalone, Cluster, and Sentinel modes
  • Complete data type operations (strings, hashes, lists, sets, sorted sets)
  • Advanced features: distributed locking, rate limiting, pub/sub, pipelines, transactions
  • JSON serialization helpers
  • TLS support with certificate authentication
  • Connection pooling with configurable parameters
  • Three Uber FX modules (Standalone/Cluster/Failover)

3. Schema Registry (v1/schema_registry)

  • Confluent Schema Registry client
  • Support for Avro, JSON, and Protobuf schemas
  • Serializer/Deserializer interfaces for Kafka integration
  • Schema caching for performance
  • Compatibility checking
  • Uber FX module for dependency injection

🧪 Testing

All packages include comprehensive testing:

  • Integration tests using testcontainers (skip with -short flag for CI/CD)
  • Unit tests for serializers, error handling, and business logic
  • Consistent testing patterns across all packages

🔧 Integration

All packages follow the established std library patterns:

  • ✅ Configuration structs with sensible defaults
  • ✅ Uber FX modules for dependency injection
  • ✅ Lifecycle management (OnStart/OnStop hooks)
  • ✅ Logger interface integration (optional)
  • ✅ Context support for cancellation and timeouts
  • ✅ Custom error types with helper functions
  • ✅ Comprehensive package documentation
  • ✅ Thread-safe implementations

📝 Documentation

  • Complete package documentation in doc.go files
  • Extensive documentation files in docs/v1/
  • Usage examples and best practices
  • README updated with new package links

Dependencies Added

github.com/redis/go-redis/v9 v9.17.2
github.com/segmentio/kafka-go v0.4.47
github.com/linkedin/goavro/v2 v2.13.0

Breaking Changes

None - all new packages with no changes to existing code.

…tegration

Added a new `kafka` package offering robust Kafka client functionality, including message publishing, consuming, and lifecycle management. Integrated FX module for simplified dependency injection. Packaged features include distributed tracing, header injection, and structured logging. Comprehensive unit and integration tests ensure reliability.
Enhanced the Kafka package with serializer and deserializer APIs for seamless message encoding and decoding. Introduced configurable serializers and deserializers with support for JSON, Protobuf, and Avro formats. Updated client and message handling methods to integrate serialization logic. Expanded documentation with examples for serialization use cases.
Integrated schema registry with support for JSON, Protobuf, and Avro serializers and deserializers. Introduced schema management APIs, caching, compatibility checks, and wire format encoding/decoding. Added Fx module for dependency injection and extensive unit tests to ensure functionality. Updated documentation with usage examples.
…client

Introduced the `DataType` field in Kafka client configuration for automatic serializer and deserializer selection, supporting JSON (default), Gob, string, bytes, and custom implementations like Protobuf and Avro. Added helper methods for setting and validating default serializers. Updated documentation with detailed usage examples for serialization.
…egration tests

Introduced a Redis client with robust configuration options, including support for single-node, cluster, and sentinel setups. Integrated Fx modules for simplified dependency injection. Added structured logging, TLS support, and default connection pooling. Comprehensive unit and integration tests validate key-value, hash, list, set, and pub/sub operations. Updated documentation with detailed examples and usage guidelines.
Added checks to skip Kafka integration tests when running in short mode (`testing.Short`). This ensures tests are not executed in environments where integration tests are explicitly excluded.
@abolfazl-alemi-aa abolfazl-alemi-aa merged commit e6658ab into main Dec 21, 2025
4 checks passed
@abolfazl-alemi-aa abolfazl-alemi-aa deleted the feat/add-kafka-redis-schema-registry branch December 21, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants