Skip to main content

ISO8583 I/O gear

The io_iso8583 gear functions as the Signal Pre-amp (Input Stage) for financial protocol orchestration. It is a specialized Native Gear (Go) responsible for TCP capture, framing, and signal integrity.

The gear uses the Moov ISO8583 protocol library inside a high-concurrency bus architecture. It provides a gateway between external payment endpoints (Acquirers, Issuers, or Hardware) and the Active Orchestration & Switching.

AttributeDetails
AnalogySignal Pre-amp (Input Stage)
Source Codepkg/gears/native/iso8583/io
Pairs WithSignal Leveler (Normalization)
Always Emitted Metadatapeer.ip, peer.port, conn.id, fluxrig.source, heuristic fields
Conditionally Emittediso8583.*_id (routing), raw_header
Mandatory Consumedconn.id (Session Stickiness Pin)
Signals SentNone
Signals Subscribedconn.close (Kill Switch) via Control Plane (flux.ctrl.>)

Reference​

fluxrig gears doc io_iso8583 generates the identity, ports, and configuration below from the gear's manifest, so they stay in lockstep with the code.

Typeio_iso8583
Categoryio
Statusstable
Terminusio

ISO 8583 TCP I/O: framing, TPDU, native TLS/mTLS. Bridges one bidirectional socket onto two unidirectional ports.

Ports

PortDirectionRoleSummary
ininputegressPayload to frame and write to the socket (responses in server mode, requests in client mode).
outoutputingressDeframed payload read from the socket (requests in server mode, responses in client mode).

Configuration

FieldTypeRequiredDefaultDescription
modeenum: server, clientyes-server (listen for terminal/peer connections) or client (dial an upstream).
bindstring-server mode: address to listen on, e.g. ':8583'.
connectstring-client mode: upstream address to dial, host:port.
connect_timeoutstring5sclient mode: max time for the TCP dial.
encodingenum: ascii, ebcdic, bcdasciifield encoding used for heuristic inspection: ascii, ebcdic or bcd.
event_queue_sizeinteger1024connection events that wait for the publisher. A full queue drops the event with a Warn, and the connection goes on.
frame_includes_headerbooleanfalsewhether the length prefix counts its own bytes.
frame_length_endianenum: big, littlebigbyte order of the length prefix.
frame_length_sizeenum: 2, 42bytes in the length prefix that frames each message (2 or 4).
heuristic_validationbooleantruerun lightweight MTI/bitmap sanity checks on each frame read.
idle_timeoutstring15smax time a connection may sit idle between frames before it is closed.
max_connectionsinteger4096server mode: maximum concurrent connections (0 = unlimited).
on_missing_connectionenum: drop, same_remote_ip, same_listenerdropserver mode: what to do with a reply whose connection no longer exists, for example after the peer reconnected. drop refuses it; same_remote_ip sends it on the newest connection from the remote IP of the request; same_listener sends it on the newest connection of this server. Applies while strict_connection_routing is true.
preserve_headersboolean-carry the raw protocol header through so the reply can mirror it.
protocol_header_sizeinteger-fixed protocol-header length (bytes) carried before the ISO message; 0 = none.
publish_eventsbooleantruepublish a durable event when a connection opens and when it closes. With clients that connect for each transaction, this is two writes to disk per connection.
read_timeoutstring5smax time to read the body of a frame already in progress, e.g. '5s'.
reconnect_waitstring5sclient mode: delay before redialing a dropped connection, e.g. '5s'.
stop_timeoutstring5smax time to wait, when the gear stops, for the connection handlers to finish and for their closed events to leave. 0s does not wait.
strict_connection_routingbooleantruereturn each reply on the exact connection (conn.id) its request arrived on.
tlsobject-native TLS/mTLS for this socket.
tpdu_enabledbooleanfalsewhether a 5-byte TPDU precedes the message.
tpdu_lengthinteger5TPDU length in bytes when enabled.
tpdu_swapbooleantrueswap the TPDU source/destination addresses on the reply.
unsafe_raw_frame_logbooleanfalselog raw frame bytes (hex) at TRACE. Off by default; raw frames carry PAN/SAD, so never enable inside a CDE.
variantenum: generic, visa, mastercardgenericframing profile: generic, visa (VAP header) or mastercard.
visa_dst_idstring-visa variant: destination station id in the VAP header.
visa_src_idstring-visa variant: source station id in the VAP header.
write_timeoutstring2smax time for a single socket write.

Architectural signal path​

In the fluxrig channel strip, the I/O gear focuses purely on signal integrity and framed capture, decoupling from the heavier normalization logic.

IMPORTANT

Wires are unidirectional. Sockets are bidirectional. Inside fluxrig, every wire carries messages in exactly one direction. A TCP connection carries bytes both ways. The I/O gear is the bridge between these two worlds: it maps one bidirectional socket onto two unidirectional ports. The gear deframes everything received from the socket and emits it on out. The gear frames everything arriving on in and writes it to the socket. This mapping is identical in server and client mode. Only who starts the connection differs.

What flows through each port depends on the gear's mode, because the mode determines which side speaks first, not how the ports work:

Modeout emits (received from socket)in consumes (written to socket)
server (terminals dial in)Requests from terminalsResponses going back to terminals
client (gear dials upstream)Responses from the upstream hostRequests going to the upstream host

A request/response round trip therefore always uses both wires of the gear. One message leaves through out. After processing elsewhere in the scenario, one message enters through in. The conn.id metadata pins the response to the same socket the request arrived on.

A reply for a connection that is gone​

In server mode, a reply goes back on the connection that its request arrived on (the conn.id metadata). A peer can drop that connection and reconnect before the reply is ready. The field on_missing_connection sets what the gear does then.

ValueWhat the gear does with the reply
drop (default)Refuses the reply and logs an error.
same_remote_ipSends it on the newest active connection from the remote IP of the request (peer.ip). The gear does not compare the remote port, because the port changes when a peer reconnects.
same_listenerSends it on the newest active connection of this server.

A reply for a connection that is still open always goes on that connection. If the value finds no connection, the gear refuses the reply, as drop does. When the gear moves a reply to another connection, it writes a warning with both connection ids.

Choose the value from the way your peers connect:

  • Each terminal has its own IP address: use same_remote_ip.
  • A NAT or a concentrator shares one IP address between several terminals: same_remote_ip can send a reply to another terminal of that address. Keep drop.
  • The listener has one peer only, for example a link to a host: use same_listener.

With strict_connection_routing: false, the gear sends the reply on any active connection, and on_missing_connection does not apply. Use that setting only to test a loopback.

A client has one connection, the one it dialed, and it writes every message on the current one. The field does not apply to client mode, and the configuration refuses a value other than drop there.

Connection events​

The gear publishes a durable event when a connection opens and when it closes, in server mode and in client mode. A scenario uses the event to act on a connection that has sent nothing yet, for example to send a logon. The Bento gear reads these events.

EventWhen
openedServer: when the connection is ready, before its first frame is read, so a reply to its conn_id works at once. Client: when the dial succeeds.
closedOnce, after the connection has left the gear. It has a reason.
reasonWhy the connection closed
peer_closedThe peer closed the socket.
idle_timeoutThe read of the next frame timed out.
read_errorAny other read error.
invalid_frameThe heuristic validation failed, and the gear disconnected. Server mode only.
closed_by_commandA conn.close command closed it.
stoppedThe gear stopped.

The subject is flux.evt.conn.<rack>.<gear>, in the stream flux-events of the Mixer. The body is JSON with event, conn_id, gear, rack, peer_ip, peer_port, ts and, for closed, reason. New fields can appear in a later release. Existing fields do not change.

A socket never waits for the bus. The events of a gear go through a queue of event_queue_size entries, and a full queue drops the event with a warning. When the bus does not answer, the event waits in the outbox of the Rack and leaves when the bus returns. A full outbox drops the event with a warning, and an event never takes the place of a message.

Each connection adds two events to the stream of the Mixer. Set publish_events: false to turn them off. Client mode keeps its conn.up and conn.down commands, which the conductor reads.


Operational features​

The Signal Pre-amp handles mission-critical financial streams:

  • Length-Prefixed Framing: Supports standard 2-byte or 4-byte big-endian framing boundaries.
  • TPDU Gating: Specialized logic for NII/TPDU headers, including automatic source/destination swapping on responses.
  • Security Kill Switch: Subscribes to the Universal Control Plane (flux.ctrl.{io_gear_id}). If a downstream Leveler (Codec) Gear detects a "Signal Burst" (malformed payload/parser bomb), it emits a conn.close signal. The signal forces this Pre-amp to aggressively terminate the misbehaving client's socket.
  • Heuristic Validation: Performs Layer 1.5 sanity checks (MTI peek, active bitmap detection) for real-time Telemetry without requiring full protocol parsing.

Industry variants & presets​

fluxrig supports standard "Presets" to align with major global card schemes and protocols.

VariantFraming / HeaderEncodingDescription
genericStandard 2-byteASCIIStandard switches (e.g., Postilion).
visaV.I.P. Header (22B)EBCDICVisa Base I / SMS.
mastercardMIP Header (4B)ASCIIMastercard Interface Processor.
unionpayCUP Header (46B)BinaryChina UnionPay routing blocks.
hypercomTPDU Header (5B)BCDLegacy POS/ATM terminals.

Configuration reference​

The Manifest reference table at the top of this page lists every field (framing, TPDU, TLS, connection routing, timeouts) with its type and default. This gear follows the Air-Gap First philosophy, ensuring zero-dependency operation.

CAUTION

unsafe_raw_frame_log dumps raw frame/payload bytes (hex) at TRACE. It exposes PAN and SAD, so it MUST NOT be enabled inside a Cardholder Data Environment (PCI DSS Req. 3.2/3.4). Use it for protocol debugging in non-CDE test environments only.

When you set preserve_headers, the gear captures the raw framing header into the iso8583.raw_header metadata field for exact response mirroring. Since v0.4.3 the gear hex-encodes this value authoritatively and prefixes it with hex: for CBOR compatibility.

Operational modes​

Mode: server (Listener) The primary Ingress Stage for accepting connections from external payment participants (Acquiring endpoints, POS networks, or ATM clusters).

Mode: client (Initiator) The Egress Connector, actively dialing out to upstream processing hosts, financial schemes (e.g., Visa Net), or partner banks (Issuing connectivity).


Ecosystem integration: Moov & NATS​

fluxrig embeds the Moov ISO8583 logic within its internal high-speed Master Bus. Our architecture maintains a strict Separation of Concerns:

StageResponsibilityComponent
Input StageFraming, TPDU, Socket Lifecycleio_iso8583
Mastering EngineField Normalization, Spec Validationcodec_iso8583

Benefits of this separation:

  • Opaque Routing: Route or load-balance signals at the Pre-amp level without the overhead of deep parsing.
  • Independent Scaling: The Pre-amp and Leveler stages can be scaled horizontally on different Racks if required.
  • Resilience: The Pre-amp remains "Active" even if a specific logic branch is processing a heavy transaction.

TIP

See the Signal Leveler Example for the translation stage of this signal path. Remember that only the external socket is bidirectional. Every internal hop is a unidirectional wire.