1.7 KiB
1.7 KiB
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
- All classes in
com.klaro.acquirecore.frameworkpackage - Use Spring Boot 3.x annotations
@Servicefor service beans,@Componentfor infrastructure@Transactionalfor transaction boundaries- Constructor injection preferred over field injection
- DTOs must be immutable (final fields, builder pattern)
- Error handling via
TxResultenum - Buffer operations via
ByteBufferorMap<String, Object> - Service registry via Spring DI, not manual lookup
- Unit tests required for each component