Skip to content

Examples

Isopace ships a set of runnable programs under examples/ that assemble the framework's building blocks into working switches and demos. Each is small enough to read end-to-end. None require anything beyond the Go toolchain — Isopace is stdlib-only.

git clone https://github.com/teqpace-services/isopace
cd isopace
go test ./...

At a glance

Program What it demonstrates Run
issuer Answers 0200 authorizations with 0210, approving up to a limit go run ./examples/issuer
acquirer Sends authorizations through a switch and prints the responses go run ./examples/acquirer
simulator A small switch assembled from a runtime.Host + listener + admin endpoint go run ./examples/simulator
teq The Isopace container with self-healing upstream Switch connections go run ./examples/teq
teqswitch A routing and transforming gateway: client → gateway → connector → host go run ./examples/teqswitch
runtimehost runtime.Host lifecycle, live deploy/undeploy, directory hot-redeploy go run ./examples/runtimehost
flowdemo The two-phase flow transaction manager as an in-process issuer pipeline go run ./examples/flowdemo
posdemo Shared POS logic with an end-to-end loopback test — read as a worked example (library)
playground A scratch space for trying the API go run ./examples/playground

Where the detail lives

The Getting Started guide walks through most of these with full output and the code behind them. This page is the quick catalog.

issuer and acquirer

The two programs implement a tiny acquirer ↔ issuer authorization flow over TCP.

Answers 0200 with 0210, approving up to a limit:

go run ./examples/issuer -addr 127.0.0.1:8583 -limit 10000

Sends authorizations through a switch and prints responses:

go run ./examples/acquirer -addr 127.0.0.1:8583 -n 5 -amount 2500
# stan 1 -> 0210 rc=00 auth="000001"
# ...

Run the examples

simulator

The simulator assembles a small switch from the framework's building blocks: a runtime.Host supervises an ISO-8583 listener and an admin HTTP endpoint, with the metrics registry wired in as the runtime observer.

go run ./examples/simulator -addr 127.0.0.1:8583 -admin 127.0.0.1:8584 -limit 10000
curl http://127.0.0.1:8584/healthz   # liveness
curl http://127.0.0.1:8584/readyz    # readiness (health checks)
curl http://127.0.0.1:8584/metrics   # Prometheus exposition

Simulator / test host

teq, the container

teq is the Isopace container (the jPOS Q2 analog) packaged for easy startup. It wraps runtime.Host and adds first-class switch connections: each Switch is a self-healing connector.Connector the host supervises.

go run ./examples/teq

It can also run as a daemon from a directory of JSON descriptors via cmd/teq, hot-(re)deploying as the files change:

go run ./examples/simulator -addr 127.0.0.1:8583   # a switch to talk to (terminal 1)
go run ./cmd/teq -deploy ./examples/teq/deploy      # the container (terminal 2)

teq, assembled

teqswitch, a transforming gateway

A gateway.Gateway listens for transactions, routes each to an upstream via a Forwarder, and can transform the request on the way out and the response on the way back — the store-and-forward heart of a switch. teqswitch shows the whole path client → gateway (transform) → connector → host → gateway (transform) → client, and prints a correlated lifecycle trace per transaction.

go run ./examples/teqswitch

Routing + transforming gateway

runtimehost

The runtimehost demo drives runtime.Host — the component container — on its own, with no network. It shows the start-in-order / stop-in-reverse lifecycle, live Deploy/Undeploy, and a Deployer that turns a directory of declarative JSON descriptors into running components and hot-(re)deploys them as the files change.

go run ./examples/runtimehost

Component host

flowdemo

The flowdemo runs the flow package — the two-phase transaction manager — as a small in-process issuer pipeline (no network). A prepare pass validates, routes by BIN, and reserves funds; a commit pass captures the funds, or an abort pass releases the hold and carries a decline. Journaling, the per-stage profiler, and idempotent retransmission are all wired in.

go run ./examples/flowdemo

Transaction flow