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/legacy
2026-07-18 11:09:12 +00:00
..
app [공통] util → framework 유틸 (ACM-CM-002) 2026-07-18 11:09:12 +00:00
db chore: acquire-core migration monorepo (legacy C + Spring Boot target skeleton) 2026-07-18 09:55:46 +00:00
framework/txcore chore: acquire-core migration monorepo (legacy C + Spring Boot target skeleton) 2026-07-18 09:55:46 +00:00
.gitignore chore: acquire-core migration monorepo (legacy C + Spring Boot target skeleton) 2026-07-18 09:55:46 +00:00
Makefile chore: acquire-core migration monorepo (legacy C + Spring Boot target skeleton) 2026-07-18 09:55:46 +00:00
README.md chore: acquire-core migration monorepo (legacy C + Spring Boot target skeleton) 2026-07-18 09:55:46 +00:00

acquire-core (레거시 C 매입·정산 슬라이스)

카드 매입·정산(acquiring/settlement) 업무의 레거시 C 수직 슬라이스. Tuxedo/ProFrame 계열 TP 모니터 위에서 Pro*C(임베디드 SQL) 로 작성되던 전형적인 국내 카드사 시스템의 구조를 재현하되, 외부 TP 미들웨어 설치 없이 gcc + ecpg 만으로 빌드/링크되도록 자체 프레임워크 계층(TxCore)을 포함한다.

스택

  • TxCore — 사내 표준 공통 프레임워크. Tuxedo ATMI(tpcall/tpreturn/ tpbegin)와 FML/UBF(Fchg/Fget) 관용구를 얇게 감싼 자체 C 구현. in-process 서비스 디스패치 + 고정 슬롯 키/값 버퍼로 동작하므로 Enduro/X 등 실 TP 모니터 없이 단독 링크된다. (framework/txcore/)
  • ECPG — PostgreSQL 의 Pro*C 상당 임베디드 SQL 전처리기. 업무 DBIO/서비스/ 배치는 .pgcEXEC SQL 로 SQL 을 임베드한다. 빌드 시 ecpg.c 로 전처리하고 libecpg/libpq 에 링크된다.
  • PostgreSQL — 매입/승인/정산 원장(db/schema.sql). 컴파일에는 불필요하며 실행 시 적용한다.

모듈 맵

경로 역할
framework/txcore/include/txcore.h 공통 프레임워크 API (서비스/버퍼/트랜잭션/로그)
framework/txcore/src/txcore.c in-process 디스패처 + 버퍼 + XA 스텁 구현
framework/txcore/dbio/txcore_dbio.h DBIO 결과판정/로깅 규약 (SQLCODE 매핑)
app/include/msg_layout.h 고정길이 매입 전문(電文) 레이아웃 (100바이트 positional)
app/include/acq_util.h 일자/금액/전문 유틸 선언
app/include/purchase_dbio.h 매입/정산 DBIO 인터페이스
app/common/util_date.c 일자 검증·요일·다음 영업일
app/common/util_amount.c 금액 파싱/zero-pad/원화 포맷/범위검증
app/common/util_msg.c 전문 pack/unpack·필드 복사·필수항목 검증
app/dbio/purchase_dbio.pgc ECPG DBIO: INSERT/SELECT/UPDATE/upsert + 접속
app/online/mg_recv_svc.pgc 전문수신 서비스(MG_RECV): 언팩 → TXBUF 적재
app/online/ac_intake_svc.pgc 매입접수 서비스(AC_INTAKE)+정산집계(AC_SETTLE): 검증→INSERT→tx_call
app/online/server_main.c 온라인 서버 부트스트랩(서비스 등록, tpsvrinit 상당)
app/batch/rc_match_batch.pgc 승인-매입 대사 배치(RC_MATCH): 커서 순회 + 업무규칙 + 상태갱신
db/schema.sql purchase/approval/settlement 테이블 DDL
Makefile .pgcecpg.cgcc→링크 파이프라인

빌드

docker run --rm -v "$PWD":/src -w /src debian:12 bash -lc \
  "apt-get update -qq && apt-get install -y -qq build-essential libecpg-dev libpq-dev postgresql-server-dev-all >/dev/null 2>&1; make clean; make"

산출물:

  • build/libtxcore.a — TxCore 정적 라이브러리
  • bin/acquire-core-server — 온라인 서비스 등록 데모 (DB 없이 실행 가능)
  • bin/rc_match_batch — 대사 배치 (rc_match_batch <YYYYMMDD> [db@host])

libecpg-devecpg + ecpglib + sqlca.h 를, libpq-devlibpq 를 제공한다. ECPG 생성 .c-I $(pg_config --includedir)sqlca.h/ecpglib.h 를 찾는다.

흐름

대외 전문 → [MG_RECV] 언팩·검증 → TXBUF
          → [AC_INTAKE] 검증 → tx_begin → purchase INSERT
                              → tx_call[AC_SETTLE] settlement upsert → tx_commit
(야간) [RC_MATCH] purchase(status='R') 커서 순회 → approval 대사 → status 갱신(M/U)

Spring Boot 전환 타겟

이 슬라이스는 공통 프레임워크 + 업무 모듈 2계층으로 그대로 이식된다.

레거시 C Spring Boot 타겟
txcore.h/txcore.c (tpcall/tpreturn/디스패치) 공통 프레임워크 스타터 (요청 디스패치 = @Service/@Component + 내부 호출; 서비스 레지스트리 = Spring ApplicationContext 빈 조회)
TXBUF 키/값 버퍼 요청/응답 DTO (record) + Map<String,Object> 컨텍스트
tx_begin/commit/abort (XA 스텁) @Transactional (Spring PlatformTransactionManager)
tx_log SLF4J/Logback
msg_layout.h 고정길이 전문 + util_msg.c 전문 매핑 라이브러리 (고정길이 ↔ DTO 바인딩, 예: BeanIO/커스텀 코덱)
util_date.c/util_amount.c 공통 유틸 (common 모듈, LocalDate/BigDecimal 헬퍼)
purchase_dbio.pgc (EXEC SQL) Repository 계층 (MyBatis 매퍼 XML 또는 Spring Data JPA)
mg_recv_svc / ac_intake_svc / ac_settle 업무 @Service (매입접수/정산집계 유스케이스)
server_main.c (tpsvrinit 등록) @SpringBootApplication 부트스트랩 + 컨트롤러/리스너
rc_match_batch.pgc (커서 배치) Spring Batch Job/Step (Cursor ItemReaderItemProcessor 대사 → ItemWriter)
db/schema.sql Flyway/Liquibase 마이그레이션