How do their APIs compare?
How do their APIs compare?
About codingapi/tx-lcn · 2 messages · last activity 9/5/2026
These two projects have fundamentally different kinds of "APIs," so a direct feature-for-feature comparison isn't quite apples-to-apples. Here's how they differ in nature and design:
codingapi/tx-lcn: internal protocol + annotation-driven API
tx-lcn is a distributed transaction framework, so its "API" is mostly aimed at other Java code, not HTTP clients:
- Annotation-based API for developers: The primary way application code interacts with tx-lcn is through annotations like
@LcnTransaction[txlcn-tc/src/main/java/com/codingapi/txlcn/tc/annotation/LcnTransaction.java:L1-L13], which marks a method to participate in a distributed transaction. This is a declarative, AOP-style API rather than a REST endpoint. - Internal SPI-style interfaces: Things like
TransactionStep[txlcn-tc/src/main/java/com/codingapi/txlcn/tc/control/TransactionStep.java:L10-L17] andCommitor[txlcn-tc/src/main/java/com/codingapi/txlcn/tc/control/Commitor.java:L8-L14] define small strategy interfaces (type()/run(),type()/commit()) that plug into the transaction lifecycle (notify, commit, rollback steps). - Custom wire protocol, not REST: Communication between the TC (transaction client) and TM (transaction manager) happens over a custom message protocol in
txlcn-protocol, e.g.TransactionMessage[txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/message/separate/TransactionMessage.java:L18-L30] andTransactionNotifyEvent, dispatched via aTxManagerReporteras seen inTransactionStepNotify.run()[txlcn-tc/src/main/java/com/codingapi/txlcn/tc/control/step/TransactionStepNotify.java:L20-L55]. This is a socket/event-based protocol designed for low-latency coordination between distributed nodes, not a documented public HTTP API. - JDBC interception layer:
txlcn-p6spyembeds a fork of P6Spy providing JDBC event-listener hooks (JdbcEventListenerinterface,PreparedStatementInformation, etc.) so the framework can intercept SQL execution transparently — again, an SPI/interception API, not a service API.
So tx-lcn's "API surface" is: annotations for transaction boundaries, SPI interfaces for pluggable commit/rollback strategies, and an internal binary/event protocol for TC↔TM coordination.
xkcoding/spring-boot-demo: conventional Spring MVC REST APIs
The demos expose standard REST controllers meant to be called over HTTP:
CodeGenControllerindemo-codegenexposesGET /tableto list DB tables andPOST ""to generate code and stream back a ZIP file, using@RequestBody,@RequestMapping-style annotations, and a uniformRresponse wrapper [demo-codegen/src/main/java/com/xkcoding/codegen/controller/CodeGenController.java:L26-L56].- The underlying service (
CodeGenServiceImpl) implements those endpoints by queryinginformation_schematables via raw SQL templates and returning paginated results (PageResult<Entity>) [demo-codegen/src/main/java/com/xkcoding/codegen/service/impl/CodeGenServiceImpl.java:L34-L131]. - Other modules follow the same pattern — simple
@RestControllerclasses likeIndexControllerindemo-admin-client[demo-admin/admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java:L1-L14] — each demo module is a small, self-contained Spring Boot app with a conventional web API surface.
Summary of the comparison
| Aspect | tx-lcn | spring-boot-demo |
|---|---|---|
| API consumer | Other Java services (framework users) | HTTP clients / browsers |
| API style | Annotations + SPI interfaces + custom binary protocol | Standard REST (@RestController, JSON) |
| Purpose | Coordinate distributed transactions across services | Demonstrate isolated Spring Boot integrations |
| Example |
Want to ask your own question?
Open chat for codingapi/tx-lcnPublic Q&A. Generated by RepoPilot from the actual source of codingapi/tx-lcn. AI answers can be incomplete or stale — verify before relying on them.