This repository has been archived on 2026-07-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
acquire-core-migration/MIGRATION.md

40 lines
1.7 KiB
Markdown

# TxCore → common-framework Migration Rules
## Core Mappings
| C Concept | Java/Spring Equivalent |
|-----------|------------------------|
| `tx_context_t` | `TxContext` class with `@Transactional` context |
| `txbuf_t` | `TxBuffer` DTO or `Map<String, Object>` |
| `tx_service_t` | `@Service` annotated class with `@Autowired` |
| `tx_register()` | `@Autowired` + constructor injection |
| `tx_lookup()` | Spring `ApplicationContext.getBean()` |
| `tx_dispatch()` | Direct method call or `@Autowired` service |
| `tx_begin()` | `@Transactional` method entry |
| `tx_commit()` | Transaction commit (automatic) |
| `tx_rollback()` | `TransactionAspectSupport.currentTransactionStatus().setRollbackOnly()` |
| `tx_handler_fn` | `Function<TxRequest, TxResult>` or service method |
## Package Structure
```
com.klaro.acquirecore.framework
├── TxCore.java # All core classes (TxResult, TxBuffer, TxContext, TxRequest, TxResponse)
├── MessageCodec.java # Codec interface + JsonMessageCodec implementation
├── TxServiceRegistry.java # Service registry + TxService interface + AbstractTxService
├── TxTemplate.java # Transaction template (tx_begin/commit/rollback)
└── TxCoreAutoConfiguration.java
```
## Rules
1. All classes in `com.klaro.acquirecore.framework` package
2. Use Spring Boot 3.x annotations
3. `@Service` for service beans, `@Component` for infrastructure
4. `@Transactional` for transaction boundaries
5. Constructor injection preferred over field injection
6. DTOs must be immutable (final fields, builder pattern)
7. Error handling via `TxResult` enum
8. Buffer operations via `ByteBuffer` or `Map<String, Object>`
9. Service registry via Spring DI, not manual lookup
10. Unit tests required for each component