What is Kratos Transport?
mainKratos Transport is an integrated transport layer and message broker extension set designed for the Kratos microservices framework. It provides a unified abstraction layer covering over 30 transport protocols, including message queues, RPC frameworks, real-time communication protocols, and distributed task queues.
Key features include:
- Dual-Mode Integration: Implement
transport.Serverto register directly with the Kratos service lifecycle, or use the standalonebroker.Brokerinterface for pure message proxy scenarios. - Type Safety: Leverages Go 1.18+ generics for APIs like
TypedHandler[T],Subscribe[T], andRegisterSubscriber[S, T]to prevent runtime panics. - Unified Message Abstraction: Uses
broker.Messageto encapsulate Headers, Body, Metadata, Partition, and Offset, shielding your application from underlying protocol differences. - Observability: Built-in OpenTelemetry integration for full-link tracing across publish/subscribe operations.
- Middleware Support: Bi-directional middleware chains for injecting cross-cutting concerns like logging, metrics, tracing, and rate limiting.
- Modular Design: Each transport and broker implementation is an independent Go Module, allowing you to import only what you need and avoid dependency bloat.