Skip to content

Conversation

@bittcrafter
Copy link
Collaborator

No description provided.

…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
@bittcrafter bittcrafter merged commit 2d505c8 into rmqtt:master Aug 31, 2025
10 checks passed
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.

1 participant