yaci

Local Tx Monitor

LocalTxMonitor class helps to query mempool of a local Cardano node using local tx monitor node-to-client mini protocol. This class is not thread-safe.

Get LocalTxMonitorClient

Get LocalTxMonitorClient from a LocalClientProvider instance.

LocalClientProvider localClientProvider = new LocalClientProvider(nodeSocketFile, protocolMagic);
localClientProvider.start();

LocalTxMonitorClient localTxMonitorClient = localQueryProvider.getTxMonitorClient();

Acquire a mempool snapshot

Mono<Long> mono = localTxMonitorClient.acquire();

Acquire and get mempool size

localTxMonitorClient.acquire().block(Duration.ofSeconds(10));
Mono<MempoolStatus> mono = localTxMonitorClient.getMempoolSizeAndCapacity();

Acquire and get mempool size in one call

Mono<MempoolStatus> mono = localTxMonitorClient.acquireAndGetMempoolSizeAndCapacity();

Acquire and get current mempool transactions

localTxMonitorClient.acquire().block();
Mono<List<byte[]>> mono = localTxMonitorClient.getCurrentMempoolTransactionsAsMono();

Acquire and get current mempool transactions as Flux

localTxMonitorClient.acquire().block();
Flux<byte[]> flux = localTxMonitorClient.getCurrentMempoolTransactions();