- Enduro/X 7.0.12 소스빌드 이미지(-DENABLE_POSTGRES=ON, libndrxxaecpg XA 스위치) - docker-compose: postgres(max_prepared_transactions=100) + endurox app - ECPG XA 서비스 3종: ACQUIRE→RECONCILE→SETTLE (tpservice + EXEC SQL) - 클라이언트 tpbegin/tpcall체인/tpcommit → tmsrv 2PC(prepare/commit) 원자 커밋 - 검증: 서비스 AVAIL, 커밋 row(status=S) psql 확인, 롤백 시 무잔존, pg_prepared_xacts=0 - 규명된 런타임 요건: sysctl fs.mqueue.*, ulimit msgqueue/nofile, XA open-str JSON - docs/architecture.md, README, service-catalog 설계 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
925 B
C
30 lines
925 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <atmi.h>
|
|
#include <ubf.h>
|
|
#include "acq.fd.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (tpinit(NULL) < 0) { fprintf(stderr, "tpinit FAIL: %s\n", tpstrerror(tperrno)); return 1; }
|
|
|
|
UBFH *b = (UBFH *)tpalloc("UBF", NULL, 1024);
|
|
long amount = 1000000; /* 10,000.00원 */
|
|
Bchg(b, T_MERCHANT, 0, "M0001", 0L);
|
|
Bchg(b, T_AMOUNT, 0, (char *)&amount, 0L);
|
|
|
|
long rlen = 0;
|
|
if (tpcall("ACQUIRE", (char *)b, 0L, (char **)&b, &rlen, 0L) < 0) {
|
|
fprintf(stderr, "tpcall FAIL: %s\n", tpstrerror(tperrno));
|
|
return 1;
|
|
}
|
|
|
|
long fee = 0, net = 0; char st[32] = ""; BFLDLEN l = sizeof(st);
|
|
Bget(b, T_FEE, 0, (char *)&fee, 0L);
|
|
Bget(b, T_NET, 0, (char *)&net, 0L);
|
|
Bget(b, T_STATUS, 0, st, &l);
|
|
printf(">>> TPCALL OK: amount=%ld fee=%ld net=%ld status=%s\n", amount, fee, net, st);
|
|
|
|
tpfree((char *)b); tpterm();
|
|
return 0;
|
|
}
|