Skip to content

Commit

Permalink
tidy up FixArchivePrinter
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-adaptive committed Jun 12, 2024
1 parent de96fa2 commit 664f8e4
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static void main(final String[] args)
new FixArchivePrinter(System.out, System.err).scan(args);
}

private static final char SOH = '\u0001';
private FixPProtocolType fixPProtocolType = FixPProtocolType.ILINK_3;
private String logFileDir = null;
private final IntHashSet queryStreamIds = new IntHashSet();
Expand All @@ -64,7 +65,7 @@ public static void main(final String[] args)
private FixMessagePredicate predicate = FixMessagePredicates.alwaysTrue();
private boolean follow = false;
private boolean fixp = false;
private char delimiter = Character.MIN_VALUE;
private char delimiter = SOH;
private Class<? extends FixDictionary> fixDictionaryType = null;
private Predicate<SessionHeaderDecoder> headerPredicate = null;
private final PrintStream out;
Expand Down Expand Up @@ -202,7 +203,6 @@ private void parseArgs(final String[] args)
case "log-file-dir":
logFileDir = optionValue;
break;

case "delimiter":
delimiter = optionValue.charAt(0);
break;
Expand Down Expand Up @@ -294,12 +294,11 @@ private void printHelp()

printOption(
"aeron-dir-name",
"Specifies the directory to use for archiving, should be the same as your " +
"aeronContext.aeronDirectoryName()",
"Specifies the media driver directory, should be the same as your aeronContext.aeronDirectoryName()",
true);
printOption(
"aeron-channel",
"Specifies the aeron channel that was used to by the engine",
"Specifies the aeron channel that was used by the engine",
true);

printOption(
Expand All @@ -310,15 +309,15 @@ private void printHelp()
false);
printOption(
"fix-dictionary",
"The class name of the Fix Dictionary to use, default is used if this is not provided",
"The class name of the FIX dictionary to use, default is used if this is not provided",
false);
printOption(
"ilink",
"Deprecated: use --fixp.",
false);
printOption(
"fixp",
"Suppresses the need to provide a fix dictionary on the classpath - used for situations where" +
"Suppresses the need to provide a FIX dictionary on the classpath - used for situations where" +
" only FIXP messages will be printed out",
false);
printOption(
Expand Down Expand Up @@ -364,12 +363,12 @@ private void printHelp()
printOption(
"query-stream-id",
"Only print messages where the query-stream-id matches this." +
" This should be your configuration.inboundLibraryStream() or configuration.outboundLibraryStream(). " +
" This should be your configuration.inboundLibraryStream() or configuration.outboundLibraryStream(). " +
"Defaults to outbound. Can be used twice in order to print both inbound and outbound streams.",
false);
printOption(
"follow",
"Continue to print out archive messages for a recording that is still in flight. defaults to off",
"Continue to print out archive messages for a recording that is still in flight. Defaults to off.",
false);
printOption(
"help",
Expand All @@ -378,11 +377,11 @@ private void printHelp()
printOption(
"log-file-dir",
"Specifies a logFileDir option, this should be the same as provided to your EngineConfiguration." +
" This can be used to optimize scans that are time based",
" This can be used to optimize scans that are time based",
false);
printOption(
"delimiter",
"Specifies the character to replace the binary delimiter with",
"Specifies the character which will replace the field delimiter (SOH) in printed messages",
false);
}

Expand All @@ -405,8 +404,7 @@ private void print(
{
final MessageStatus status = message.status();
final long timestamp = message.timestamp();
final String body =
delimiter != Character.MIN_VALUE ? message.body().replace('\u0001', delimiter) : message.body();
final String body = message.body().replace(SOH, delimiter);
out.printf("%1$20s: %2$s (%3$s)%n", timestamp, body, status);
}
}

0 comments on commit 664f8e4

Please sign in to comment.