refactor(codec): separate codec and broker publish types and bump codec to 0.2.0#276
Merged
bittcrafter merged 2 commits intormqtt:masterfrom Aug 31, 2025
Merged
refactor(codec): separate codec and broker publish types and bump codec to 0.2.0#276bittcrafter merged 2 commits intormqtt:masterfrom
bittcrafter merged 2 commits intormqtt:masterfrom
Conversation
…ec to 0.2.0
Major Architectural Changes:
1. **Version Updates**:
- Bumped rmqtt-codec from 0.1.2 to 0.2.0 (major version change)
- Updated workspace dependency to use rmqtt-codec 0.2
2. **Type Separation**:
- **CodecPublish**: Raw MQTT packet structure used for encoding/decoding
- Removed `delay_interval` and `create_time` fields (broker concerns)
- Simplified serialization/deserialization
- **Publish**: Broker-level structure with additional metadata
- Added `target_clientid`, `delay_interval`, and `create_time` fields
- Provides higher-level functionality for broker operations
3. **Key Improvements**:
- **Separation of Concerns**: Codec layer now purely handles MQTT protocol
- **Broker Features**: Delay publishing and creation timestamps moved to broker level
- **Type Safety**: Clear distinction between wire format and broker representation
- **Performance**: Reduced codec complexity and memory footprint
4. **API Changes**:
- Added `Deref` and `DerefMut` implementations for seamless access to inner fields
- New builder methods: `target_clientid()`, `delay_interval()`, `create_time()`
- Conversion traits between `CodecPublish` and `Publish`
5. **Affected Components**:
- All bridge plugins (Kafka, NATS, ReductStore, Pulsar, MQTT)
- HTTP API plugin
- Message storage systems
- System topics
- Topic rewriting
- Delayed publish handling
- Session management
6. **Migration**:
- Updated all internal usage to new type system
- Maintained backward compatibility through conversion traits
- Simplified timestamp handling across the codebase
Benefits:
- **Clean Architecture**: Clear separation between protocol and business logic
- **Improved Maintainability**: Each type has a single responsibility
- **Better Performance**: Reduced codec complexity
- **Enhanced Flexibility**: Broker can add metadata without affecting protocol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.