Skip to content

Commit 47e81e3

Browse files
committed
added readme for examples and tidied code
1 parent 13d27f4 commit 47e81e3

File tree

9 files changed

+50
-36
lines changed

9 files changed

+50
-36
lines changed

custom-applications/readme.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
# Example Applications
22

3-
Example applications use `quickfixj-spring-boot-starter`.
3+
The Example applications are trivial and only intended to demonstrate the build and runtime dependencies when using custom protocols.
44

5-
They are trivial examples to demonstrate runtime dependencies when using custom protocols.
5+
The example applications use `quickfixj-spring-boot-starter`.
66

7-
See the referenced projects for details about `quickfixj-spring-boot-starter`.
7+
See the referenced git repositories for details about `quickfixj-spring-boot-starter`.
8+
9+
## Running Examples
10+
11+
The examples are executable jars
12+
13+
`java -jar <jar file path> --spring.config.location=<spring config file path>`
14+
15+
or you can run them with Maven
16+
17+
`mvn spring-boot:run`
18+
19+
Piping the output to `cat` or `less` makes the FIX messages more readable by displaying the field separators
20+
21+
examples :
22+
* `mvn spring-boot:run | cat -v`
23+
* `mvn spring-boot:run | less`
24+
25+
Start a client __and__ a server with compatible customisations,i.e _fixlatest_ or _legacy-code-gen_.
26+
27+
### Expected Behaviour
28+
The processes will connect, log on and exchange FIX Session and Application messages. At time of writing, only a single
29+
"NewOrderSingle" and "ExecutionReport" are exchanged.
30+
31+
## Stopping Examples
32+
33+
Stop the examples using `Ctrl+C` .
834

935
## ref:
1036
https://github.com/esanchezros/quickfixj-spring-boot-starter
@@ -14,4 +40,5 @@ https://github.com/esanchezros/quickfixj-spring-boot-starter-examples
1440
## Kudos
1541
[Eduardo Sanchez-Ros](https://github.com/esanchezros)
1642

17-
[Contributors](https://github.com/esanchezros/quickfixj-spring-boot-starter/graphs/contributors)
43+
[Contributors](https://github.com/esanchezros/quickfixj-spring-boot-starter/graphs/contributors)
44+

custom-applications/using-fixlatest-client/src/main/java/org/quickfixj/examples/fixlatest/custom/client/ClientApplicationAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public ClientApplicationAdapter(MessageCracker messageCracker) {
2323

2424
@Override
2525
public void onLogon(SessionID sessionID) {
26-
log.info("logged on sender[{}] -> target[{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
26+
log.info("logged on [{}] - [{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
2727
try {
2828
Session.sendToTarget(newOrderSingle(),sessionID);
2929
} catch (SessionNotFound e) {
@@ -33,7 +33,7 @@ public void onLogon(SessionID sessionID) {
3333

3434
@Override
3535
public void onLogout(SessionID sessionID) {
36-
log.info("logged out sender[{}] -> target[{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
36+
log.info("logged out [{}] - [{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
3737
}
3838

3939
@Override

custom-applications/using-fixlatest-client/src/main/java/org/quickfixj/examples/fixlatest/custom/client/ClientMessageCracker.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ public class ClientMessageCracker extends MessageCracker {
2020
public void onMessage(ExecutionReport executionReport, SessionID sessionID)
2121
throws FieldNotFound {
2222
Instrument instrumentComponent = executionReport.getInstrumentComponent(); // invariant
23-
log.info("Received ExecutionReport from sender [{}]: clOrdID {}, symbol {}, side {}, transactTime {}, ordType {}",
24-
sessionID.getSenderCompID(),
23+
log.info("Received ExecutionReport from sender [{}]:: clOrdID {}, symbol {}, side {}, transactTime {}, ordType {}, securityIDSource {}, securityID {}",
24+
executionReport.getHeader().getString(SenderCompID.FIELD),
2525
instrumentComponent.getSymbol().getValue(),
2626
executionReport.getClOrdID().getValue(),
2727
executionReport.getSide().getValue(),
2828
executionReport.getTransactTime().getValue(),
29-
executionReport.getOrdType().getValue());
30-
if (instrumentComponent.isSetSecurityIDSource()) {
31-
log.info("securityIDSource {}, securityID {}",
32-
instrumentComponent.getSecurityIDSource().getValue(),
33-
instrumentComponent.getSecurityID().getValue());
34-
}
29+
executionReport.getOrdType().getValue(),
30+
instrumentComponent.isSetSecurityIDSource() ? instrumentComponent.getSecurityIDSource().getValue() : "",
31+
instrumentComponent.isSetSecurityID() ? instrumentComponent.getSecurityID().getValue() : "");
3532
}
3633

3734
@Override

custom-applications/using-fixlatest-client/src/main/resources/application.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ management:
1818

1919
app:
2020
session:
21-
sender-comp-id: EXAMPLE-FIXLATEST-INITIATOR
21+
sender-comp-id: INITIATOR
2222

2323
quickfixj:
2424
client:
@@ -42,13 +42,12 @@ quickfixj:
4242
CheckLatency=Y
4343
HeartBtInt=30
4444
PersistMessages=N
45-
FileLogPath=target/logs-client
4645
SocketConnectHost=localhost
4746
SenderCompID=${app.session.sender-comp-id}
4847
4948
#SSL
5049
SocketUseSSL=N
5150
5251
[session]
53-
TargetCompID=EXAMPLE-FIXLATEST-ACCEPTOR
52+
TargetCompID=ACCEPTOR
5453
SocketConnectPort=9881

custom-applications/using-fixlatest-server/src/main/java/org/quickfixj/examples/fixlatest/custom/server/ServerApplicationAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public ServerApplicationAdapter(MessageCracker messageCracker) {
1717

1818
@Override
1919
public void onLogon(SessionID sessionID) {
20-
log.info("logged on sender[{}] -> target[{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
20+
log.info("logged on [{}] - [{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
2121
}
2222

2323
@Override
2424
public void onLogout(SessionID sessionID) {
25-
log.info("logged out sender[{}] -> target[{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
25+
log.info("logged out [{}] - [{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID());
2626
}
2727

2828
@Override

custom-applications/using-fixlatest-server/src/main/java/org/quickfixj/examples/fixlatest/custom/server/ServerApplicationConfiguration.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,4 @@ Acceptor acceptor(Application application,
2929
logFactory,
3030
messageFactory);
3131
}
32-
33-
@Bean
34-
public LogFactory serverLogFactory(SessionSettings serverSessionSettings) {
35-
return new FileLogFactory(serverSessionSettings);
36-
}
3732
}

custom-applications/using-fixlatest-server/src/main/java/org/quickfixj/examples/fixlatest/custom/server/ServerMessageCracker.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ public class ServerMessageCracker extends MessageCracker {
2020
public void onMessage(NewOrderSingle newOrderSingle, SessionID sessionID)
2121
throws FieldNotFound {
2222
Instrument instrumentComponent = newOrderSingle.getInstrumentComponent(); // invariant
23-
log.info("Received NewOrderSingle from sender [{}]: clOrdID {}, symbol {}, side {}, transactTime {}, ordType {}",
24-
sessionID.getSenderCompID(),
23+
log.info("Received NewOrderSingle from sender [{}]: clOrdID {}, symbol {}, side {}, transactTime {}, ordType {}, securityIDSource {}, securityID {}",
24+
newOrderSingle.getHeader().getString(SenderCompID.FIELD),
2525
instrumentComponent.getSymbol().getValue(),
2626
newOrderSingle.getClOrdID().getValue(),
2727
newOrderSingle.getSide().getValue(),
2828
newOrderSingle.getTransactTime().getValue(),
29-
newOrderSingle.getOrdType().getValue());
30-
if (instrumentComponent.isSetSecurityIDSource()) {
31-
log.info("securityIDSource {}, securityID {}",
32-
instrumentComponent.getSecurityIDSource().getValue(),
33-
instrumentComponent.getSecurityID().getValue());
34-
}
29+
newOrderSingle.getOrdType().getValue(),
30+
instrumentComponent.isSetSecurityIDSource() ? instrumentComponent.getSecurityIDSource().getValue() : "",
31+
instrumentComponent.isSetSecurityID() ? instrumentComponent.getSecurityID().getValue() : "");
3532
try {
3633
Session.sendToTarget(executionReport(newOrderSingle),sessionID);
3734
} catch (SessionNotFound e) {

custom-applications/using-fixlatest-server/src/main/resources/application.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ logging:
2626

2727
app:
2828
session:
29-
sender-comp-id: EXAMPLE-FIXLATEST-ACCEPTOR
29+
sender-comp-id: ACCEPTOR
3030
socket-accept-port: 9881
3131

3232
quickfixj:
@@ -60,12 +60,11 @@ quickfixj:
6060
CheckLatency=Y
6161
HeartBtInt=30
6262
PersistMessages=N
63-
FileLogPath=target/logs-server
6463
SenderCompID=${app.session.sender-comp-id}
6564
SocketAcceptPort=${app.session.socket-accept-port}
6665
6766
#SSL
6867
SocketUseSSL=N
6968
7069
[session]
71-
TargetCompID=EXAMPLE-FIXLATEST-INITIATOR
70+
TargetCompID=INITIATOR

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115

116116
<modules>
117117
<module>custom-application-messages</module>
118-
<module>custom-legacy-codegen-application-messages</module>
118+
<!-- <module>custom-legacy-codegen-application-messages</module>-->
119119
<module>custom-applications</module>
120120
</modules>
121121

0 commit comments

Comments
 (0)