How do their APIs compare?
How do their APIs compare?
About codingapi/tx-lcn · 2 messages · last activity 9/6/2026
These two projects have fundamentally different API philosophies, reflecting their different problem domains — one is an internal RPC-style protocol for coordinating distributed transactions, the other is a full HTTP/JSON open API for job orchestration.
tx-lcn: internal event/message-driven protocol
tx-lcn's "API" isn't a typical REST surface aimed at end users — it's an internal client-to-manager messaging protocol used by the TC (transaction client) to talk to the TM (transaction manager). The pattern is consistent across the transaction lifecycle:
- Create:
TransactionStepCreate.run()sends aTransactionCreateEventviamanagerProtocoler.requestMsg(...)to start a transaction group, and throwsTxExceptionif the TM doesn't respond [txlcn-tc/src/main/java/com/codingapi/txlcn/tc/control/step/TransactionStepCreate.java:L29-L37]. - Join:
TransactionStepJoin.run()sends aTransactionJoinEventto attach a participant to the group, then asynchronously blocks on aLockwaiting for the TM's commit/rollback decision viaexecuteJoin()[txlcn-tc/src/main/java/com/codingapi/txlcn/tc/control/step/TransactionStepJoin.java:L50-L94]. - Notify:
TransactionStepNotify.run()reports the local execution result back with aTransactionNotifyEvent, retrying if the TM hasn't replied yet, then commits or rolls back locally based on the response [txlcn-tc/src/main/java/com/codingapi/txlcn/tc/control/step/TransactionStepNotify.java:L32-L52].
These are all implementations of a common TransactionStep interface, keyed by a TransactionState enum (CREATE/JOIN/NOTIFY), and driven over a custom binary/socket protocol configured via TM host:port addresses in TxConfig (tms, txManagerAddresses()) [txlcn-tc/src/main/java/com/codingapi/txlcn/tc/config/TxConfig.java:L49-L52,L67-L76]. There's no public HTTP contract here — it's a purpose-built RPC protocol (txlcn-protocol module) for transaction coordination, not something external clients or third parties call directly.
xxl-job: explicit HTTP/JSON open API
xxl-job, by contrast, exposes a genuine external-facing API meant for other systems to integrate with. OpenApiController.api() is a single HTTP endpoint (/api/{uri}) that dispatches by a uri path variable to distinct operations — callback, registry, registryRemove, addJob, updateJob, removeJob, startJob, stopJob, triggerJob — each deserializing a JSON request body into a typed request object (e.g. JobAddRequest, JobTriggerRequest) and delegating to AdminBiz or AdminJobBiz [xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/openapi/OpenApiController.java:L38-L106]. It authenticates via accessToken + appname headers checked against a registered XxlJobGroup's token [xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/openapi/OpenApiController.java:L47-L53].
Alongside this open API, xxl-job also has a conventional admin-console REST layer for the web UI itself, e.g. JobInfoController (/stop, /start, /trigger endpoints gated by session login via XxlSsoHelper.loginCheckWithAttr) [xxl-job-admin/src/main/java/com/xxl/job/admin/business/controller/JobInfoController.java:L133-L157] and JobCodeController.save() for editing GLUE job source code with input validation (blank/length/XSS checks) [xxl-job-admin/src/main/java/com/xxl/job/admin/business/controller/JobCodeController.java:L64-L100].
Summary of the contrast
| Aspect | tx-lcn | xxl-job |
|---|---|---|
| Audience | Internal TC↔TM coordination only | External systems (open API) + admin UI |
| Transport | Custom socket protoc |
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.