Skip navigation

Implementing a Pretty Printer

You need to implement the interface hermes.fix.FIXPrettyPrinter:

public class AcmeFIXPrettyPrinter implements FIXPrettyPrinter
{
   public String print(FIXMessage message)
   {
         // Format the message to a string...
   }
}

You can view the default implementation here.

Once you've compiled your code (and you can find the FIXPrettyPrinter interface hermes.jar ether put the JAR in the Hermes lib directory or load it up at runtime.

It is easiest to use Python to reconfigure Hermes:

from hermes.browser import  HermesBrowser
from com.acme.fix import AcmeFIXPrettyPrinter

HermesBrowser.getBrowser().setFIXPrettyPrinter(AcmeFIXPrettyPrinter())

// or if using a custom classloader...

classLoader = browser.getLoader().getClassLoaderManager().getClassLoader("My Custom Code")
HermesBrowser.getBrowser().setFIXPrettyPrinter(classLoader.loadClass("com.acme.fix.AcmeFIXPrettyPrinter").newInstance())

Alternative Pretty Print Format

There is an alternative FIX pretty printer called hermes.fix.VerbosePrettyPrinter that is a little more verbose than the default:

INET -> EDGE
    BeginString <8> = FIX.4.0
    BodyLength <9> = 152
    MsgSeqNum <34> = 6810
    MsgType <35> = 8 <ExecutionReport>
    SenderCompID <49> = INET
    SendingTime <52> = 20060320-19:35:50
    TargetCompID <56> = EDGE
    AvgPx <6> = 20
    ClOrdID <11> = QAA20190000B2V
    CumQty <14> = 3200
    ExecID <17> = 5624
    ExecTransType <20> = 0 <NEW>
    LastPx <31> = 20
    LastShares <32> = 100
    OrderID <37> = 00000H
    OrderQty <38> = 250000
    OrdStatus <39> = 1 <PARTIALLY_FILLED>
    Side <54> = 1 <BUY>
    Symbol <55> = MSFT
    Text <58> = NEW
    CheckSum <10> = 129

Adaptavist Theme Builder Powered by Atlassian Confluence