├── .editorconfig
├── .github
└── workflows
│ └── maven.yml
├── .gitignore
├── .travis.yml
├── README.adoc
├── docker-server-client-with-database
├── pom.xml
└── src
│ └── main
│ └── docker
│ ├── client-database
│ ├── Dockerfile
│ └── quickfixj-client.cfg
│ ├── database
│ └── quickfixj-db.sql
│ ├── docker-compose.yml
│ └── server-database
│ ├── Dockerfile
│ └── quickfixj-server.cfg
├── docker-server-client-with-failover
├── pom.xml
└── src
│ └── main
│ └── docker
│ ├── client-failover
│ ├── Dockerfile
│ └── quickfixj-client-failover.cfg
│ ├── docker-compose-failover.yml
│ └── server-failover
│ ├── Dockerfile
│ └── quickfixj-server.cfg
├── docker-server-client
├── pom.xml
└── src
│ └── main
│ └── docker
│ ├── client
│ ├── Dockerfile
│ └── quickfixj-client.cfg
│ ├── docker-compose.yml
│ └── server
│ ├── Dockerfile
│ └── quickfixj-server.cfg
├── licence-header.txt
├── pom.xml
├── simple-client-and-server-config-string
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── sender
│ │ ├── SenderController.java
│ │ └── SimpleClientAndServerConfigString.java
│ └── resources
│ ├── application.yml
│ └── sender.http
├── simple-client-and-server-spring-3
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── sender
│ │ ├── SenderController.java
│ │ └── SimpleClientAndServer.java
│ └── resources
│ ├── application.yml
│ ├── quickfixj-client.cfg
│ ├── quickfixj-server.cfg
│ └── sender.http
├── simple-client-and-server
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── sender
│ │ ├── SenderController.java
│ │ └── SimpleClientAndServer.java
│ └── resources
│ ├── application.yml
│ ├── quickfixj-client.cfg
│ ├── quickfixj-server.cfg
│ └── sender.http
├── simple-client-listener
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── client
│ │ ├── ApplicationListener.java
│ │ └── SimpleClientListener.java
│ └── resources
│ ├── application.yml
│ └── quickfixj-client.cfg
├── simple-client-spring-3
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── client
│ │ ├── ApplicationMessageCracker.java
│ │ ├── ClientApplicationAdapter.java
│ │ ├── SimpleClientSpring3.java
│ │ └── TestController.java
│ └── resources
│ ├── application.yml
│ └── quickfixj-client.cfg
├── simple-client-with-database
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── client
│ │ ├── ClientApplicationAdapter.java
│ │ ├── DbConfiguration.java
│ │ └── SimpleClientWithDatabase.java
│ └── resources
│ ├── application.yml
│ ├── hsqldb
│ └── data.sql
│ ├── log4j.properties
│ └── quickfixj-client.cfg
├── simple-client
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── client
│ │ ├── ApplicationMessageCracker.java
│ │ ├── ClientApplicationAdapter.java
│ │ ├── SimpleClient.java
│ │ └── TestController.java
│ └── resources
│ ├── application.yml
│ └── quickfixj-client.cfg
├── simple-server-dynamic-sessions
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── server
│ │ ├── ServerApplicationAdapter.java
│ │ └── SimpleServerDynamicSessions.java
│ └── resources
│ ├── application.yml
│ ├── log4j.properties
│ └── quickfixj-server.cfg
├── simple-server-listener
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── server
│ │ ├── ApplicationListener.java
│ │ └── SimpleServerListener.java
│ └── resources
│ ├── application.yml
│ └── quickfixj-server.cfg
├── simple-server-sender
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── io
│ │ │ └── allune
│ │ │ └── quickfixj
│ │ │ └── spring
│ │ │ └── boot
│ │ │ └── starter
│ │ │ └── examples
│ │ │ └── sender
│ │ │ ├── SenderController.java
│ │ │ └── SimpleServerSender.java
│ └── resources
│ │ ├── application.yml
│ │ ├── quickfixj-server.cfg
│ │ └── sender.http
│ └── test
│ └── java
│ └── io
│ └── allune
│ └── quickfixj
│ └── spring
│ └── boot
│ └── starter
│ └── examples
│ └── sender
│ ├── SenderControllerGetPath1IntegrationTest.java
│ └── SenderControllerGetPath2IntegrationTest.java
├── simple-server-spring-3
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── server
│ │ ├── ServerApplicationAdapter.java
│ │ └── SimpleServerSpring3.java
│ └── resources
│ ├── application.yml
│ ├── log4j.properties
│ └── quickfixj-server.cfg
├── simple-server-with-database
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── allune
│ │ └── quickfixj
│ │ └── spring
│ │ └── boot
│ │ └── starter
│ │ └── examples
│ │ └── server
│ │ ├── DbConfiguration.java
│ │ ├── ServerApplicationAdapter.java
│ │ └── SimpleServerWithDatabase.java
│ └── resources
│ ├── application.yml
│ ├── hsqldb
│ └── data.sql
│ ├── log4j.properties
│ └── quickfixj-server.cfg
└── simple-server
├── pom.xml
└── src
└── main
├── java
└── io
│ └── allune
│ └── quickfixj
│ └── spring
│ └── boot
│ └── starter
│ └── examples
│ └── server
│ ├── ServerApplicationAdapter.java
│ └── SimpleServer.java
└── resources
├── application.yml
├── log4j.properties
└── quickfixj-server.cfg
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: https://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | [*]
7 | indent_style = tab
8 | indent_size = 4
9 | end_of_line = lf
10 | insert_final_newline = true
11 |
12 | [*.yml]
13 | indent_style = space
14 | indent_size = 2
15 |
--------------------------------------------------------------------------------
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3 |
4 | name: Java CI with Maven
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | pull_request:
10 | branches: [ main ]
11 | workflow_dispatch:
12 |
13 | jobs:
14 | build:
15 | name: Build maven projects
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v2
21 |
22 | - name: Set up JDK 17
23 | uses: actions/setup-java@v2
24 | with:
25 | distribution: zulu
26 | java-version: 17
27 |
28 | - name: Install dependencies
29 | run: mvn clean install
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | **/target
3 | .idea/
4 | **/*.iml
5 | **/.project
6 | **/.settings
7 | **/*.log
8 | /db/**
9 | /data/**
10 | /logs/**
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk8
4 | dist: trusty
5 | sudo: required
6 |
7 | services:
8 | - docker
9 |
10 | script: "mvn clean verify"
--------------------------------------------------------------------------------
/README.adoc:
--------------------------------------------------------------------------------
1 | image:https://travis-ci.org/esanchezros/quickfixj-spring-boot-starter-examples.svg?branch=2.0.x["Build Status",link="https://travis-ci.org/esanchezros/quickfixj-spring-boot-starter-examples"]
2 | image:https://img.shields.io/badge/maven%20central-v2.17.1-blue.svg["Maven Central",link="https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22quickfixj-spring-boot-starter-examples%22"]
3 | image:https://img.shields.io/hexpm/l/plug.svg["Apache 2",link="http://www.apache.org/licenses/LICENSE-2.0"]
4 | image:https://img.shields.io/badge/quickfixj-2.3.1-blue.svg["QuickFIX/J 2.3.1",link="https://github.com/quickfix-j/quickfixj"]
5 |
6 | = Spring Boot Starter Examples for QuickFIX/J (Spring Boot 2 and Spring Boot 3)
7 |
8 | == Main project
9 |
10 | https://github.com/esanchezros/quickfixj-spring-boot-starter[quickfixj-spring-boot-starter]
11 |
12 | === Build the project
13 |
14 | mvn clean install
15 |
16 | === Simple Server Example
17 |
18 | The simple server example can be run directly from the IDE or in the command line:
19 |
20 | java -jar simple-server/target/simple-server.jar
21 |
22 | === Simple Server with Application Listener Example
23 |
24 | The simple server example can be run directly from the IDE or in the command line:
25 |
26 | java -jar simple-server-listener/target/simple-server-listener.jar
27 |
28 | === Simple Client Example
29 |
30 | The simple client example can be run directly from the IDE or in the command line:
31 |
32 | java -jar simple-client/target/simple-client.jar
33 |
34 | === Simple Client with Application Listener Example
35 |
36 | The simple client example can be run directly from the IDE or in the command line:
37 |
38 | java -jar simple-client-listener/target/simple-client-listener.jar
39 |
40 | === Docker Examples
41 |
42 | To build the docker containers:
43 |
44 | mvn clean install -DskipDocker=false
45 |
46 | ==== Client-Server
47 |
48 | Go to `docker-server-client/src/main/docker` and run:
49 |
50 | docker-compose -f docker-compose.yml up -d
51 |
52 | ==== Client-Server with Failover
53 |
54 | Go to `docker-server-client-with-failover/src/main/docker` and run:
55 |
56 | docker-compose -f docker-compose-failover.yml up -d
57 |
58 | If you want to see the failover in action, kill the first server container and see the client reconnecting to the second server after around a minute or so:
59 |
60 | docker rm -f quickfixj-spring-boot-server
61 |
--------------------------------------------------------------------------------
/docker-server-client-with-database/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | docker-server-client-with-database
11 |
12 | QuickFixJ Spring Boot Starter Examples :: Docker Server Client with Database
13 | QuickFixJ Spring Boot Starter Docker Server and Client with Database
14 |
15 |
16 |
17 | io.allune
18 | simple-server-with-database
19 |
20 |
21 | io.allune
22 | simple-client-with-database
23 |
24 |
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-maven-plugin
31 |
32 |
33 |
34 | repackage
35 |
36 |
37 |
38 |
39 | true
40 |
41 |
42 |
43 | io.fabric8
44 | docker-maven-plugin
45 |
46 |
47 |
48 | simple-server-database
49 | ${docker.image.prefix}/simple-server-database:latest
50 |
51 | ${basedir}/src/main/docker/server-database
52 | ${skipDocker}
53 |
54 |
55 |
56 |
57 |
58 | io.allune:simple-server-with-database
59 |
60 | .
61 | simple-server-with-database.jar
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | simple-client-database
71 | ${docker.image.prefix}/simple-client-database:latest
72 |
73 | ${basedir}/src/main/docker/client-database
74 | ${skipDocker}
75 |
76 |
77 |
78 |
79 |
80 | io.allune:simple-client-with-database
81 |
82 | .
83 | simple-client-with-database.jar
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | build-container
96 | package
97 |
98 | build
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/docker-server-client-with-database/src/main/docker/client-database/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-alpine
2 |
3 | ADD maven/simple-client-with-database.jar /opt/app/application.jar
4 | ADD quickfixj-client.cfg /opt/app/quickfixj-client.cfg
5 | RUN mkdir -p /tmp/logs
6 |
7 | EXPOSE 8080
8 | EXPOSE 8000
9 |
10 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /opt/app/application.jar" ]
11 |
--------------------------------------------------------------------------------
/docker-server-client-with-database/src/main/docker/client-database/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/banzai
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=quickfixj-spring-boot-server
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=30
10 | ReconnectInterval=5
11 | FileLogPath=/tmp/logs
12 | JdbcDriver=com.mysql.cj.jdbc.Driver
13 | JdbcURL=jdbc:mysql://mysqldb-client:3306/quickfix
14 | JdbcUser=testuser
15 | JdbcPassword=testuser
16 | JdbcLogHeartBeats=N
17 | JdbcStoreMessagesTableName=messages
18 | JdbcStoreSessionsTableName=sessions
19 | JdbcLogEventTable=event_log
20 | JdbcLogIncomingTable=messages_log
21 | JdbcLogOutgoingTable=messages_log
22 |
23 | [session]
24 | BeginString=FIX.4.0
25 | SocketConnectPort=9876
26 |
27 | [session]
28 | BeginString=FIX.4.1
29 | SocketConnectPort=9877
30 |
31 | [session]
32 | BeginString=FIX.4.2
33 | SocketConnectPort=9878
34 |
35 | [session]
36 | BeginString=FIX.4.3
37 | SocketConnectPort=9879
38 |
39 | [session]
40 | BeginString=FIX.4.4
41 | SocketConnectPort=9880
42 |
43 | [session]
44 | BeginString=FIXT.1.1
45 | DefaultApplVerID=FIX.5.0
46 | SocketConnectPort=9881
--------------------------------------------------------------------------------
/docker-server-client-with-database/src/main/docker/database/quickfixj-db.sql:
--------------------------------------------------------------------------------
1 | CREATE USER IF NOT EXISTS 'testuser'@'%' IDENTIFIED BY 'testuser';
2 | GRANT ALL PRIVILEGES ON quickfix.* TO 'testuser'@'%' WITH GRANT OPTION;
3 | FLUSH PRIVILEGES;
4 |
5 | USE quickfix;
6 |
7 | CREATE TABLE sessions
8 | (
9 | beginstring CHAR(8) NOT NULL,
10 | sendercompid VARCHAR(64) NOT NULL,
11 | sendersubid VARCHAR(64) NOT NULL,
12 | senderlocid VARCHAR(64) NOT NULL,
13 | targetcompid VARCHAR(64) NOT NULL,
14 | targetsubid VARCHAR(64) NOT NULL,
15 | targetlocid VARCHAR(64) NOT NULL,
16 | session_qualifier VARCHAR(64) NOT NULL,
17 | creation_time DATETIME NOT NULL,
18 | incoming_seqnum INT NOT NULL,
19 | outgoing_seqnum INT NOT NULL,
20 | PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
21 | targetcompid, targetsubid, targetlocid, session_qualifier)
22 | );
23 |
24 |
25 | CREATE TABLE messages
26 | (
27 | beginstring CHAR(8) NOT NULL,
28 | sendercompid VARCHAR(64) NOT NULL,
29 | sendersubid VARCHAR(64) NOT NULL,
30 | senderlocid VARCHAR(64) NOT NULL,
31 | targetcompid VARCHAR(64) NOT NULL,
32 | targetsubid VARCHAR(64) NOT NULL,
33 | targetlocid VARCHAR(64) NOT NULL,
34 | session_qualifier VARCHAR(64) NOT NULL,
35 | msgseqnum INT NOT NULL,
36 | message TEXT NOT NULL,
37 | PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
38 | targetcompid, targetsubid, targetlocid, session_qualifier,
39 | msgseqnum)
40 | );
41 |
42 |
43 | CREATE TABLE messages_log
44 | (
45 | id INT UNSIGNED NOT NULL AUTO_INCREMENT,
46 | time DATETIME NOT NULL,
47 | beginstring CHAR(8) NOT NULL,
48 | sendercompid VARCHAR(64) NOT NULL,
49 | sendersubid VARCHAR(64) NOT NULL,
50 | senderlocid VARCHAR(64) NOT NULL,
51 | targetcompid VARCHAR(64) NOT NULL,
52 | targetsubid VARCHAR(64) NOT NULL,
53 | targetlocid VARCHAR(64) NOT NULL,
54 | session_qualifier VARCHAR(64) NOT NULL,
55 | text TEXT NOT NULL,
56 | PRIMARY KEY (id)
57 | );
58 |
59 |
60 | CREATE TABLE event_log
61 | (
62 | id INT UNSIGNED NOT NULL AUTO_INCREMENT,
63 | time DATETIME NOT NULL,
64 | beginstring CHAR(8) NOT NULL,
65 | sendercompid VARCHAR(64) NOT NULL,
66 | sendersubid VARCHAR(64) NOT NULL,
67 | senderlocid VARCHAR(64) NOT NULL,
68 | targetcompid VARCHAR(64) NOT NULL,
69 | targetsubid VARCHAR(64) NOT NULL,
70 | targetlocid VARCHAR(64) NOT NULL,
71 | session_qualifier VARCHAR(64),
72 | text TEXT NOT NULL,
73 | PRIMARY KEY (id)
74 | );
75 |
--------------------------------------------------------------------------------
/docker-server-client-with-database/src/main/docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2.1'
2 | services:
3 |
4 | busybox:
5 | image: busybox
6 | depends_on:
7 | mysqldb-server:
8 | condition: service_healthy
9 | mysqldb-client:
10 | condition: service_healthy
11 | quickfixj-spring-boot-server:
12 | condition: service_healthy
13 | quickfixj-spring-boot-client:
14 | condition: service_healthy
15 |
16 | quickfixj-spring-boot-server:
17 | image: allune/simple-server-database
18 | container_name: quickfixj-spring-boot-server
19 | environment:
20 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n -Xmx512m -Xms512m -Dspring.profiles.active=docker"
21 | QUICKFIXJ_SERVER_CONFIG_FILE: "file:/opt/app/quickfixj-server.cfg"
22 | depends_on:
23 | mysqldb-server:
24 | condition: service_healthy
25 | ports:
26 | - "9800:8000"
27 | - "9080:8080"
28 | healthcheck:
29 | test: "netstat -nl | grep -q 9881"
30 | interval: 6s
31 | timeout: 3s
32 | retries: 10
33 |
34 | quickfixj-spring-boot-client:
35 | image: allune/simple-client-database
36 | container_name: quickfixj-spring-boot-client
37 | environment:
38 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n -Xmx512m -Xms512m -Dspring.profiles.active=docker"
39 | QUIICKFIXJ_CLIENT_CONFIG_FILE: "file:/opt/app/quickfixj-client.cfg"
40 | depends_on:
41 | quickfixj-spring-boot-server:
42 | condition: service_healthy
43 | mysqldb-client:
44 | condition: service_healthy
45 | ports:
46 | - "9801:8000"
47 | - "9081:8080"
48 | healthcheck:
49 | test: "netstat -natu | grep 'ESTABLISHED' | grep 9881"
50 | interval: 6s
51 | timeout: 3s
52 | retries: 10
53 |
54 | mysqldb-server:
55 | image: mysql
56 | volumes:
57 | - ./database:/docker-entrypoint-initdb.d
58 | restart: always
59 | environment:
60 | MYSQL_ROOT_PASSWORD: root
61 | MYSQL_DATABASE: quickfix
62 | MYSQL_USER: testuser
63 | MYSQL_PASSWORD: testuser
64 | ports:
65 | - "3306:3306"
66 | healthcheck:
67 | test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
68 | timeout: 20s
69 | retries: 10
70 |
71 | mysqldb-client:
72 | image: mysql
73 | volumes:
74 | - ./database:/docker-entrypoint-initdb.d
75 | restart: always
76 | environment:
77 | MYSQL_ROOT_PASSWORD: root
78 | MYSQL_DATABASE: quickfix
79 | MYSQL_USER: testuser
80 | MYSQL_PASSWORD: testuser
81 | ports:
82 | - "3307:3306"
83 | healthcheck:
84 | test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
85 | timeout: 20s
86 | retries: 10
--------------------------------------------------------------------------------
/docker-server-client-with-database/src/main/docker/server-database/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-alpine
2 |
3 | ADD maven/simple-server-with-database.jar /opt/app/application.jar
4 | ADD quickfixj-server.cfg /opt/app/quickfixj-server.cfg
5 | RUN mkdir -p /tmp/logs
6 |
7 | EXPOSE 9876
8 | EXPOSE 9877
9 | EXPOSE 9878
10 | EXPOSE 9879
11 | EXPOSE 9880
12 | EXPOSE 9881
13 | EXPOSE 8080
14 | EXPOSE 8000
15 |
16 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /opt/app/application.jar" ]
17 |
--------------------------------------------------------------------------------
/docker-server-client-with-database/src/main/docker/server-database/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 | FileLogPath=/tmp/logs
13 | JdbcDriver=com.mysql.cj.jdbc.Driver
14 | JdbcURL=jdbc:mysql://mysqldb-server:3306/quickfix
15 | JdbcUser=testuser
16 | JdbcPassword=testuser
17 | JdbcLogHeartBeats=N
18 | JdbcStoreMessagesTableName=messages
19 | JdbcStoreSessionsTableName=sessions
20 | JdbcLogEventTable=event_log
21 | JdbcLogIncomingTable=messages_log
22 | JdbcLogOutgoingTable=messages_log
23 |
24 | [session]
25 | BeginString=FIX.4.0
26 | SocketAcceptPort=9876
27 |
28 | [session]
29 | BeginString=FIX.4.1
30 | SocketAcceptPort=9877
31 |
32 | [session]
33 | BeginString=FIX.4.2
34 | SocketAcceptPort=9878
35 |
36 | [session]
37 | BeginString=FIX.4.3
38 | SocketAcceptPort=9879
39 |
40 | [session]
41 | BeginString=FIX.4.4
42 | SocketAcceptPort=9880
43 |
44 | [session]
45 | BeginString=FIXT.1.1
46 | DefaultApplVerID=FIX.5.0
47 | SocketAcceptPort=9881
--------------------------------------------------------------------------------
/docker-server-client-with-failover/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | docker-server-client-with-failover
11 |
12 | QuickFixJ Spring Boot Starter Examples :: Docker Server Client with Failover
13 | QuickFixJ Spring Boot Starter Docker Server Client with Failover
14 |
15 |
16 |
17 | io.allune
18 | simple-server
19 |
20 |
21 | io.allune
22 | simple-client
23 |
24 |
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-maven-plugin
31 |
32 |
33 |
34 | repackage
35 |
36 |
37 |
38 |
39 | true
40 |
41 |
42 |
43 | io.fabric8
44 | docker-maven-plugin
45 |
46 |
47 |
48 | simple-server-failover
49 | ${docker.image.prefix}/simple-server-failover:latest
50 |
51 | ${basedir}/src/main/docker/server-failover
52 | ${skipDocker}
53 |
54 |
55 |
56 |
57 |
58 | io.allune:simple-server
59 |
60 | .
61 | simple-server.jar
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | simple-client-failover
70 | ${docker.image.prefix}/simple-client-failover:latest
71 |
72 | ${basedir}/src/main/docker/client-failover
73 | ${skipDocker}
74 |
75 |
76 |
77 |
78 |
79 | io.allune:simple-client
80 |
81 | .
82 | simple-client.jar
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | build-container
94 | package
95 |
96 | build
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/docker-server-client-with-failover/src/main/docker/client-failover/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-alpine
2 |
3 | ADD maven/simple-client.jar /opt/app/application.jar
4 | ADD quickfixj-client-failover.cfg /opt/app/quickfixj-client-failover.cfg
5 | RUN mkdir -p /tmp/logs
6 |
7 | EXPOSE 8080
8 | EXPOSE 8000
9 |
10 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /opt/app/application.jar" ]
11 |
--------------------------------------------------------------------------------
/docker-server-client-with-failover/src/main/docker/client-failover/quickfixj-client-failover.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/banzai
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=quickfixj-spring-boot-server
7 | SocketConnectHost1=quickfixj-spring-boot-server-1
8 | SocketConnectHost2=quickfixj-spring-boot-server-2
9 | SocketConnectHost3=quickfixj-spring-boot-server-3
10 | StartTime=00:00:00
11 | EndTime=00:00:00
12 | HeartBtInt=30
13 | ReconnectInterval=5
14 | FileLogPath=/tmp/logs
15 |
16 | [session]
17 | BeginString=FIX.4.0
18 | SocketConnectPort=9876
19 | SocketConnectPort1=9876
20 | SocketConnectPort2=9876
21 | SocketConnectPort3=9876
22 |
23 | [session]
24 | BeginString=FIX.4.1
25 | SocketConnectPort=9877
26 | SocketConnectPort1=9877
27 | SocketConnectPort2=9877
28 | SocketConnectPort3=9877
29 |
30 | [session]
31 | BeginString=FIX.4.2
32 | SocketConnectPort=9878
33 | SocketConnectPort1=9878
34 | SocketConnectPort2=9878
35 | SocketConnectPort3=9878
36 |
37 | [session]
38 | BeginString=FIX.4.3
39 | SocketConnectPort=9879
40 | SocketConnectPort1=9879
41 | SocketConnectPort2=9879
42 | SocketConnectPort3=9879
43 |
44 | [session]
45 | BeginString=FIX.4.4
46 | SocketConnectPort=9880
47 | SocketConnectPort1=9880
48 | SocketConnectPort2=9880
49 | SocketConnectPort3=9880
50 |
51 | [session]
52 | BeginString=FIXT.1.1
53 | DefaultApplVerID=FIX.5.0
54 | SocketConnectPort=9881
55 | SocketConnectPort1=9881
56 | SocketConnectPort2=9881
57 | SocketConnectPort3=9881
58 |
--------------------------------------------------------------------------------
/docker-server-client-with-failover/src/main/docker/docker-compose-failover.yml:
--------------------------------------------------------------------------------
1 | version: '2.1'
2 | services:
3 |
4 | busybox:
5 | image: busybox
6 | depends_on:
7 | quickfixj-spring-boot-server:
8 | condition: service_healthy
9 | quickfixj-spring-boot-server-1:
10 | condition: service_healthy
11 | quickfixj-spring-boot-server-2:
12 | condition: service_healthy
13 | quickfixj-spring-boot-server-3:
14 | condition: service_healthy
15 | quickfixj-spring-boot-client-failover:
16 | condition: service_healthy
17 |
18 | quickfixj-spring-boot-client-failover:
19 | image: allune/simple-client-failover
20 | container_name: quickfixj-spring-boot-client-failover
21 | environment:
22 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n -Xmx512m -Xms512m"
23 | QUIICKFIXJ_CLIENT_CONFIG_FILE: "file:/opt/app/quickfixj-client-failover.cfg"
24 | depends_on:
25 | quickfixj-spring-boot-server:
26 | condition: service_healthy
27 | quickfixj-spring-boot-server-1:
28 | condition: service_healthy
29 | quickfixj-spring-boot-server-2:
30 | condition: service_healthy
31 | quickfixj-spring-boot-server-3:
32 | condition: service_healthy
33 | ports:
34 | - "9001:8000"
35 | - "9081:8080"
36 | healthcheck:
37 | test: "netstat -natu | grep 'ESTABLISHED' | grep 9881"
38 | interval: 6s
39 | timeout: 3s
40 | retries: 10
41 |
42 | quickfixj-spring-boot-server:
43 | image: allune/simple-server
44 | container_name: quickfixj-spring-boot-server
45 | environment:
46 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n -Xmx512m -Xms512m"
47 | QUICKFIXJ_SERVER_CONFIG_FILE: "file:/opt/app/quickfixj-server.cfg"
48 | ports:
49 | - "9000:8000"
50 | - "9080:8080"
51 | healthcheck:
52 | test: "netstat -nl | grep -q 9881"
53 | interval: 6s
54 | timeout: 3s
55 | retries: 10
56 |
57 | quickfixj-spring-boot-server-1:
58 | image: allune/simple-server
59 | container_name: quickfixj-spring-boot-server-1
60 | environment:
61 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n"
62 | QUICKFIXJ_SERVER_CONFIG_FILE: "file:/opt/app/quickfixj-server.cfg"
63 | ports:
64 | - "9002:8000"
65 | - "9082:8080"
66 | healthcheck:
67 | test: "netstat -nl | grep -q 9881"
68 | interval: 6s
69 | timeout: 3s
70 | retries: 10
71 |
72 | quickfixj-spring-boot-server-2:
73 | image: allune/simple-server
74 | container_name: quickfixj-spring-boot-server-2
75 | environment:
76 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n"
77 | QUICKFIXJ_SERVER_CONFIG_FILE: "file:/opt/app/quickfixj-server.cfg"
78 | ports:
79 | - "9003:8000"
80 | - "9083:8080"
81 | healthcheck:
82 | test: "netstat -nl | grep -q 9881"
83 | interval: 6s
84 | timeout: 3s
85 | retries: 10
86 |
87 | quickfixj-spring-boot-server-3:
88 | image: allune/simple-server
89 | container_name: quickfixj-spring-boot-server-3
90 | environment:
91 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n"
92 | QUICKFIXJ_SERVER_CONFIG_FILE: "file:/opt/app/quickfixj-server.cfg"
93 | ports:
94 | - "9004:8000"
95 | - "9084:8080"
96 | healthcheck:
97 | test: "netstat -nl | grep -q 9881"
98 | interval: 6s
99 | timeout: 3s
100 | retries: 10
--------------------------------------------------------------------------------
/docker-server-client-with-failover/src/main/docker/server-failover/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-alpine
2 |
3 | ADD maven/simple-server.jar /opt/app/application.jar
4 | ADD quickfixj-server.cfg /opt/app/quickfixj-server.cfg
5 | RUN mkdir -p /tmp/logs
6 |
7 | EXPOSE 9876
8 | EXPOSE 9877
9 | EXPOSE 9878
10 | EXPOSE 9879
11 | EXPOSE 9880
12 | EXPOSE 9881
13 | EXPOSE 8080
14 | EXPOSE 8000
15 |
16 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /opt/app/application.jar" ]
17 |
--------------------------------------------------------------------------------
/docker-server-client-with-failover/src/main/docker/server-failover/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 | FileLogPath=/tmp/logs
13 |
14 | [session]
15 | BeginString=FIX.4.0
16 | SocketAcceptPort=9876
17 |
18 | [session]
19 | BeginString=FIX.4.1
20 | SocketAcceptPort=9877
21 |
22 | [session]
23 | BeginString=FIX.4.2
24 | SocketAcceptPort=9878
25 |
26 | [session]
27 | BeginString=FIX.4.3
28 | SocketAcceptPort=9879
29 |
30 | [session]
31 | BeginString=FIX.4.4
32 | SocketAcceptPort=9880
33 |
34 | [session]
35 | BeginString=FIXT.1.1
36 | DefaultApplVerID=FIX.5.0
37 | SocketAcceptPort=9881
--------------------------------------------------------------------------------
/docker-server-client/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | docker-server-client
11 |
12 | QuickFixJ Spring Boot Starter Examples :: Docker Server Client
13 | QuickFixJ Spring Boot Starter Docker Server Client
14 |
15 |
16 |
17 | io.allune
18 | simple-server
19 |
20 |
21 | io.allune
22 | simple-client
23 |
24 |
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-maven-plugin
31 |
32 |
33 |
34 | repackage
35 |
36 |
37 |
38 |
39 | true
40 |
41 |
42 |
43 | io.fabric8
44 | docker-maven-plugin
45 |
46 |
47 |
48 | simple-server
49 | ${docker.image.prefix}/simple-server:latest
50 |
51 | ${basedir}/src/main/docker/server
52 | ${skipDocker}
53 |
54 |
55 |
56 |
57 |
58 | io.allune:simple-server
59 |
60 | .
61 | simple-server.jar
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | simple-client
70 | ${docker.image.prefix}/simple-client:latest
71 |
72 | ${basedir}/src/main/docker/client
73 | ${skipDocker}
74 |
75 |
76 |
77 |
78 |
79 | io.allune:simple-client
80 |
81 | .
82 | simple-client.jar
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | build-container
94 | package
95 |
96 | build
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/docker-server-client/src/main/docker/client/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-alpine
2 |
3 | ADD maven/simple-client.jar /opt/app/application.jar
4 | ADD quickfixj-client.cfg /opt/app/quickfixj-client.cfg
5 | RUN mkdir -p /tmp/logs
6 |
7 | EXPOSE 8080
8 | EXPOSE 8000
9 |
10 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /opt/app/application.jar" ]
11 |
--------------------------------------------------------------------------------
/docker-server-client/src/main/docker/client/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/banzai
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=quickfixj-spring-boot-server
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=30
10 | ReconnectInterval=5
11 | FileLogPath=/tmp/logs
12 |
13 | [session]
14 | BeginString=FIX.4.0
15 | SocketConnectPort=9876
16 |
17 | [session]
18 | BeginString=FIX.4.1
19 | SocketConnectPort=9877
20 |
21 | [session]
22 | BeginString=FIX.4.2
23 | SocketConnectPort=9878
24 |
25 | [session]
26 | BeginString=FIX.4.3
27 | SocketConnectPort=9879
28 |
29 | [session]
30 | BeginString=FIX.4.4
31 | SocketConnectPort=9880
32 |
33 | [session]
34 | BeginString=FIXT.1.1
35 | DefaultApplVerID=FIX.5.0
36 | SocketConnectPort=9881
37 |
--------------------------------------------------------------------------------
/docker-server-client/src/main/docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2.1'
2 | services:
3 |
4 | busybox:
5 | image: busybox
6 | depends_on:
7 | quickfixj-spring-boot-server:
8 | condition: service_healthy
9 | quickfixj-spring-boot-client:
10 | condition: service_healthy
11 |
12 | quickfixj-spring-boot-server:
13 | image: allune/simple-server
14 | container_name: quickfixj-spring-boot-server
15 | environment:
16 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n -Xmx512m -Xms512m"
17 | QUICKFIXJ_SERVER_CONFIG_FILE: "file:/opt/app/quickfixj-server.cfg"
18 | ports:
19 | - "9800:8000"
20 | - "9080:8080"
21 | healthcheck:
22 | test: "netstat -nl | grep -q 9881"
23 | interval: 6s
24 | timeout: 3s
25 | retries: 10
26 |
27 | quickfixj-spring-boot-client:
28 | image: allune/simple-client
29 | container_name: quickfixj-spring-boot-client
30 | environment:
31 | JAVA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n -Xmx512m -Xms512m"
32 | QUIICKFIXJ_CLIENT_CONFIG_FILE: "file:/opt/app/quickfixj-client.cfg"
33 | depends_on:
34 | quickfixj-spring-boot-server:
35 | condition: service_healthy
36 | ports:
37 | - "9801:8000"
38 | - "9081:8080"
39 | healthcheck:
40 | test: "netstat -natu | grep 'ESTABLISHED' | grep 9881"
41 | interval: 6s
42 | timeout: 3s
43 | retries: 10
--------------------------------------------------------------------------------
/docker-server-client/src/main/docker/server/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-alpine
2 |
3 | ADD maven/simple-server.jar /opt/app/application.jar
4 | ADD quickfixj-server.cfg /opt/app/quickfixj-server.cfg
5 | RUN mkdir -p /tmp/logs
6 |
7 | EXPOSE 9876
8 | EXPOSE 9877
9 | EXPOSE 9878
10 | EXPOSE 9879
11 | EXPOSE 9880
12 | EXPOSE 9881
13 | EXPOSE 8080
14 | EXPOSE 8000
15 |
16 | ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /opt/app/application.jar" ]
17 |
--------------------------------------------------------------------------------
/docker-server-client/src/main/docker/server/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 | FileLogPath=/tmp/logs
13 |
14 | [session]
15 | BeginString=FIX.4.0
16 | SocketAcceptPort=9876
17 |
18 | [session]
19 | BeginString=FIX.4.1
20 | SocketAcceptPort=9877
21 |
22 | [session]
23 | BeginString=FIX.4.2
24 | SocketAcceptPort=9878
25 |
26 | [session]
27 | BeginString=FIX.4.3
28 | SocketAcceptPort=9879
29 |
30 | [session]
31 | BeginString=FIX.4.4
32 | SocketAcceptPort=9880
33 |
34 | [session]
35 | BeginString=FIXT.1.1
36 | DefaultApplVerID=FIX.5.0
37 | SocketAcceptPort=9881
--------------------------------------------------------------------------------
/licence-header.txt:
--------------------------------------------------------------------------------
1 | Copyright ${inceptionYear}-${currentYear} the original author or authors.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | io.allune
6 | quickfixj-spring-boot-starter-examples
7 | 2.17.2-SNAPSHOT
8 | pom
9 |
10 | QuickFixJ Spring Boot Starter Examples
11 | QuickFixJ Spring Boot Starter Examples
12 | https://github.com/esanchezros/quickfixj-spring-boot-starter-examples
13 |
14 |
15 | simple-client
16 | simple-client-spring-3
17 | simple-client-listener
18 | simple-client-with-database
19 | simple-client-and-server
20 | simple-client-and-server-config-string
21 | simple-client-and-server-spring-3
22 | simple-server
23 | simple-server-spring-3
24 | simple-server-listener
25 | simple-server-sender
26 | simple-server-with-database
27 | simple-server-dynamic-sessions
28 | docker-server-client
29 | docker-server-client-with-failover
30 | docker-server-client-with-database
31 |
32 |
33 |
34 |
35 | Apache License, Version 2.0
36 | http://www.apache.org/licenses/LICENSE-2.0
37 |
38 |
39 |
40 |
41 |
42 | esanchezros
43 | Eduardo Sanchez-Ros
44 | esanchezros@yahoo.es
45 |
46 |
47 |
48 |
49 | https://github.com/esanchezros/quickfixj-spring-boot-starter-examples
50 | scm:git:git@github.com:esanchezros/quickfixj-spring-boot-starter-examples.git
51 | scm:git:git@github.com:esanchezros/quickfixj-spring-boot-starter-examples.git
52 |
53 | HEAD
54 |
55 |
56 |
57 | UTF-8
58 | UTF-8
59 | 1.8
60 |
61 | true
62 | allune
63 | 2.17.1
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | org.springframework.boot
72 | spring-boot-dependencies
73 | 2.7.15
74 | pom
75 | import
76 |
77 |
78 |
79 | org.yaml
80 | snakeyaml
81 | 2.1
82 |
83 |
84 |
85 | io.allune
86 | quickfixj-spring-boot-starter
87 | ${quickfixj-spring-boot-starter.version}
88 |
89 |
90 | io.allune
91 | quickfixj-spring-boot-actuator
92 | ${quickfixj-spring-boot-starter.version}
93 |
94 |
95 | io.allune
96 | simple-server
97 | ${project.version}
98 |
99 |
100 | io.allune
101 | simple-server-with-database
102 | ${project.version}
103 |
104 |
105 | io.allune
106 | simple-client
107 | ${project.version}
108 |
109 |
110 | io.allune
111 | simple-client-with-database
112 | ${project.version}
113 |
114 |
115 | org.projectlombok
116 | lombok
117 | 1.18.22
118 |
119 |
120 | org.yaml
121 | snakeyaml
122 | 2.0
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | org.springframework.boot
131 | spring-boot-maven-plugin
132 |
133 |
134 |
135 | repackage
136 |
137 |
138 |
139 |
140 |
141 | org.sonatype.plugins
142 | nexus-staging-maven-plugin
143 | 1.6.13
144 | true
145 |
146 | ossrh
147 | https://oss.sonatype.org/
148 | true
149 |
150 |
151 |
152 | com.mycila
153 | license-maven-plugin
154 | 4.1
155 |
156 |
157 |
158 |
159 |
160 | 2017
161 | 2023
162 |
163 | true
164 |
165 | src/**/*.java
166 | src/**/pom.xml
167 |
168 |
169 | SLASHSTAR_STYLE
170 |
171 |
172 |
173 |
174 | validate
175 |
176 | format
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 | org.apache.maven.plugins
186 | maven-compiler-plugin
187 | 3.10.1
188 |
189 | 1.8
190 | 1.8
191 |
192 |
193 |
194 | org.apache.maven.plugins
195 | maven-release-plugin
196 | 2.5.3
197 |
198 | true
199 | false
200 | release
201 | deploy
202 |
203 |
204 |
205 | io.fabric8
206 | docker-maven-plugin
207 | 0.28.0
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 | ossrh
216 | https://oss.sonatype.org/content/repositories/snapshots
217 |
218 |
219 | ossrh
220 | https://oss.sonatype.org/service/local/staging/deploy/maven2/
221 |
222 |
223 |
224 |
225 |
226 | release
227 |
228 |
229 |
230 | org.apache.maven.plugins
231 | maven-gpg-plugin
232 | 3.0.1
233 |
234 |
235 | sign-artifacts
236 | verify
237 |
238 | sign
239 |
240 |
241 |
242 |
243 |
244 | org.apache.maven.plugins
245 | maven-source-plugin
246 | 3.2.1
247 |
248 |
249 | attach-sources
250 |
251 | jar-no-fork
252 |
253 |
254 |
255 |
256 |
257 | org.apache.maven.plugins
258 | maven-javadoc-plugin
259 | 3.4.1
260 |
261 |
262 | attach-javadocs
263 |
264 | jar
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
--------------------------------------------------------------------------------
/simple-client-and-server-config-string/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | simple-client-and-server-config-string
11 | QuickFixJ Spring Boot Starter Examples :: Simple Client and Server using Config String
12 | QuickFixJ Spring Boot Starter Simple Client and Server using Config String
13 |
14 |
15 |
16 |
17 |
18 |
19 | org.springframework.boot
20 | spring-boot-dependencies
21 | 3.2.2
22 | pom
23 | import
24 |
25 |
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter-web
32 |
33 |
34 | io.allune
35 | quickfixj-spring-boot-starter
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/simple-client-and-server-config-string/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SenderController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.template.QuickFixJTemplate;
19 | import org.springframework.web.bind.annotation.RequestMapping;
20 | import org.springframework.web.bind.annotation.RequestParam;
21 | import org.springframework.web.bind.annotation.ResponseStatus;
22 | import org.springframework.web.bind.annotation.RestController;
23 | import quickfix.Acceptor;
24 | import quickfix.Initiator;
25 | import quickfix.Message;
26 | import quickfix.SessionID;
27 | import quickfix.StringField;
28 | import quickfix.field.ClOrdID;
29 | import quickfix.field.OrigClOrdID;
30 | import quickfix.field.QuoteID;
31 | import quickfix.field.Side;
32 | import quickfix.field.Symbol;
33 | import quickfix.field.Text;
34 |
35 | import java.util.HashMap;
36 | import java.util.Map;
37 |
38 | import static java.util.UUID.randomUUID;
39 | import static org.springframework.http.HttpStatus.OK;
40 | import static quickfix.FixVersions.BEGINSTRING_FIX41;
41 | import static quickfix.FixVersions.BEGINSTRING_FIXT11;
42 |
43 | @RestController
44 | public class SenderController {
45 |
46 | private static final Map> messageMap = createMessageMap();
47 |
48 | private final Acceptor serverAcceptor;
49 |
50 | private final QuickFixJTemplate quickFixJTemplate;
51 |
52 | private final Initiator clientInitiator;
53 |
54 | public SenderController(
55 | Acceptor serverAcceptor,
56 | QuickFixJTemplate quickFixJTemplate,
57 | Initiator clientInitiator) {
58 | this.serverAcceptor = serverAcceptor;
59 | this.quickFixJTemplate = quickFixJTemplate;
60 | this.clientInitiator = clientInitiator;
61 | }
62 |
63 | private static HashMap> createMessageMap() {
64 | HashMap> stringMapHashMap = new HashMap<>();
65 | stringMapHashMap.put(BEGINSTRING_FIX41, initialiseFix41MessageMap());
66 | stringMapHashMap.put(BEGINSTRING_FIXT11, initialiseFix50MessageMap());
67 | return stringMapHashMap;
68 | }
69 |
70 | private static Map initialiseFix41MessageMap() {
71 | Map messageMap = new HashMap<>();
72 | messageMap.put("OrderCancelRequest", new quickfix.fix41.OrderCancelRequest(
73 | new OrigClOrdID("123"),
74 | new ClOrdID("321"),
75 | new Symbol("LNUX"),
76 | new Side(Side.BUY)));
77 | return messageMap;
78 | }
79 |
80 | private static Map initialiseFix50MessageMap() {
81 | Map messageMap = new HashMap<>();
82 | messageMap.put("Quote", new quickfix.fix50.Quote(new QuoteID("123")));
83 | return messageMap;
84 | }
85 |
86 | @RequestMapping("/send-client-message")
87 | @ResponseStatus(OK)
88 | public void sendMessageToClient(@RequestParam String fixVersion, @RequestParam String messageType) {
89 | Map stringMessageMap = messageMap.get(fixVersion);
90 | Message message = stringMessageMap.get(messageType);
91 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
92 |
93 | SessionID sessionID = serverAcceptor.getSessions().stream()
94 | .filter(id -> id.getBeginString().equals(fixVersion))
95 | .findFirst()
96 | .orElseThrow(RuntimeException::new);
97 | quickFixJTemplate.send(message, sessionID);
98 | }
99 |
100 | @RequestMapping("/send-server-message")
101 | @ResponseStatus(OK)
102 | public void sendMessageToServer(@RequestParam String fixVersion, @RequestParam String messageType) {
103 |
104 | Map stringMessageMap = messageMap.get(fixVersion);
105 | Message message = stringMessageMap.get(messageType);
106 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
107 |
108 | SessionID sessionID = clientInitiator.getSessions().stream()
109 | .filter(id -> id.getBeginString().equals(fixVersion))
110 | .findFirst()
111 | .orElseThrow(RuntimeException::new);
112 | quickFixJTemplate.send(message, sessionID);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/simple-client-and-server-config-string/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SimpleClientAndServerConfigString.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 |
23 | @EnableQuickFixJServer
24 | @EnableQuickFixJClient
25 | @SpringBootApplication
26 | public class SimpleClientAndServerConfigString {
27 |
28 | public static void main(String[] args) {
29 | SpringApplication.run(SimpleClientAndServerConfigString.class, args);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/simple-client-and-server-config-string/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8089
3 |
4 |
5 | management:
6 | endpoint:
7 | quickfixjclient:
8 | enabled: true
9 | quickfixjserver:
10 | enabled: true
11 | endpoints:
12 | web:
13 | exposure:
14 | include: quickfixjclient,quickfixjserver
15 |
16 | logging:
17 | file:
18 | name: logs/client-and-server.log
19 | pattern:
20 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
21 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
22 |
23 | quickfixj:
24 | client:
25 | configString: |
26 | [default]
27 | FileStorePath=target/data/initiator
28 | ConnectionType=initiator
29 | SenderCompID=BANZAI
30 | TargetCompID=EXEC
31 | SocketConnectHost=localhost
32 | StartTime=00:00:00
33 | EndTime=00:00:00
34 | HeartBtInt=5
35 | ReconnectInterval=5
36 | FileLogPath=logs-client
37 |
38 | [session]
39 | BeginString=FIX.4.1
40 | SocketConnectPort=9877
41 |
42 | server:
43 | configString: |
44 | [default]
45 | FileStorePath=target/data/acceptor
46 | ConnectionType=acceptor
47 | SenderCompID=EXEC
48 | TargetCompID=BANZAI
49 | StartTime=00:00:00
50 | EndTime=00:00:00
51 | HeartBtInt=5
52 | ReconnectInterval=5
53 | FileLogPath=logs-server
54 |
55 | [session]
56 | BeginString=FIX.4.1
57 | SocketAcceptPort=9877
58 |
--------------------------------------------------------------------------------
/simple-client-and-server-config-string/src/main/resources/sender.http:
--------------------------------------------------------------------------------
1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection) or
2 | # paste cURL into the file and request will be converted to HTTP Request format.
3 | #
4 | # Following HTTP Request Live Templates are available:
5 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters;
6 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
7 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
8 |
9 | ### Send FIX.4.1 - OrderCancelRequest to client
10 | GET http://localhost:8089/send-client-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
11 |
12 | ### Send FIXT1.1 - Quote to client
13 | GET http://localhost:8089/send-client-message?fixVersion=FIXT.1.1&messageType=Quote
14 |
15 | ###
16 |
17 | ### Send FIX.4.1 - OrderCancelRequest to server
18 | GET http://localhost:8089/send-server-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
19 |
20 | ### Send FIXT1.1 - Quote to server
21 | GET http://localhost:8089/send-server-message?fixVersion=FIXT.1.1&messageType=Quote
22 |
23 | ###
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | simple-client-and-server-spring-3
11 | QuickFixJ Spring Boot Starter Examples :: Simple Client and Server Spring 3
12 | QuickFixJ Spring Boot Starter Simple Client and Server Spring 3
13 |
14 |
15 | UTF-8
16 | UTF-8
17 | 17
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-dependencies
27 | 3.2.2
28 | pom
29 | import
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | io.allune
38 | quickfixj-spring-boot-starter
39 |
40 |
41 |
42 | io.allune
43 | quickfixj-spring-boot-actuator
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-starter-web
49 |
50 |
51 |
52 | org.springframework.boot
53 | spring-boot-starter-test
54 | test
55 |
56 |
57 |
58 | org.projectlombok
59 | lombok
60 |
61 |
62 |
63 |
64 | ${project.artifactId}
65 |
66 |
67 | org.springframework.boot
68 | spring-boot-maven-plugin
69 |
70 |
71 |
72 | repackage
73 |
74 |
75 |
76 |
77 |
78 | org.apache.maven.plugins
79 | maven-compiler-plugin
80 | 3.3
81 |
82 | 17
83 | 17
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SenderController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.template.QuickFixJTemplate;
19 | import org.springframework.web.bind.annotation.RequestMapping;
20 | import org.springframework.web.bind.annotation.RequestParam;
21 | import org.springframework.web.bind.annotation.ResponseStatus;
22 | import org.springframework.web.bind.annotation.RestController;
23 | import quickfix.Acceptor;
24 | import quickfix.Initiator;
25 | import quickfix.Message;
26 | import quickfix.SessionID;
27 | import quickfix.StringField;
28 | import quickfix.field.ClOrdID;
29 | import quickfix.field.OrigClOrdID;
30 | import quickfix.field.QuoteID;
31 | import quickfix.field.Side;
32 | import quickfix.field.Symbol;
33 | import quickfix.field.Text;
34 |
35 | import java.util.HashMap;
36 | import java.util.Map;
37 |
38 | import static java.util.UUID.randomUUID;
39 | import static org.springframework.http.HttpStatus.OK;
40 | import static quickfix.FixVersions.BEGINSTRING_FIX41;
41 | import static quickfix.FixVersions.BEGINSTRING_FIXT11;
42 |
43 | @RestController
44 | public class SenderController {
45 |
46 | private static final Map> messageMap = createMessageMap();
47 |
48 | private final Acceptor serverAcceptor;
49 |
50 | private final QuickFixJTemplate quickFixJTemplate;
51 |
52 | private final Initiator clientInitiator;
53 |
54 | public SenderController(
55 | Acceptor serverAcceptor,
56 | QuickFixJTemplate quickFixJTemplate,
57 | Initiator clientInitiator) {
58 | this.serverAcceptor = serverAcceptor;
59 | this.quickFixJTemplate = quickFixJTemplate;
60 | this.clientInitiator = clientInitiator;
61 | }
62 |
63 | private static HashMap> createMessageMap() {
64 | HashMap> stringMapHashMap = new HashMap<>();
65 | stringMapHashMap.put(BEGINSTRING_FIX41, initialiseFix41MessageMap());
66 | stringMapHashMap.put(BEGINSTRING_FIXT11, initialiseFix50MessageMap());
67 | return stringMapHashMap;
68 | }
69 |
70 | private static Map initialiseFix41MessageMap() {
71 | Map messageMap = new HashMap<>();
72 | messageMap.put("OrderCancelRequest", new quickfix.fix41.OrderCancelRequest(
73 | new OrigClOrdID("123"),
74 | new ClOrdID("321"),
75 | new Symbol("LNUX"),
76 | new Side(Side.BUY)));
77 | return messageMap;
78 | }
79 |
80 | private static Map initialiseFix50MessageMap() {
81 | Map messageMap = new HashMap<>();
82 | messageMap.put("Quote", new quickfix.fix50.Quote(new QuoteID("123")));
83 | return messageMap;
84 | }
85 |
86 | @RequestMapping("/send-client-message")
87 | @ResponseStatus(OK)
88 | public void sendMessageToClient(@RequestParam String fixVersion, @RequestParam String messageType) {
89 | Map stringMessageMap = messageMap.get(fixVersion);
90 | Message message = stringMessageMap.get(messageType);
91 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
92 |
93 | SessionID sessionID = serverAcceptor.getSessions().stream()
94 | .filter(id -> id.getBeginString().equals(fixVersion))
95 | .findFirst()
96 | .orElseThrow(RuntimeException::new);
97 | quickFixJTemplate.send(message, sessionID);
98 | }
99 |
100 | @RequestMapping("/send-server-message")
101 | @ResponseStatus(OK)
102 | public void sendMessageToServer(@RequestParam String fixVersion, @RequestParam String messageType) {
103 |
104 | Map stringMessageMap = messageMap.get(fixVersion);
105 | Message message = stringMessageMap.get(messageType);
106 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
107 |
108 | SessionID sessionID = clientInitiator.getSessions().stream()
109 | .filter(id -> id.getBeginString().equals(fixVersion))
110 | .findFirst()
111 | .orElseThrow(RuntimeException::new);
112 | quickFixJTemplate.send(message, sessionID);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SimpleClientAndServer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 |
23 | @EnableQuickFixJServer
24 | @EnableQuickFixJClient
25 | @SpringBootApplication
26 | public class SimpleClientAndServer {
27 |
28 | public static void main(String[] args) {
29 | SpringApplication.run(SimpleClientAndServer.class, args);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8089
3 |
4 | management:
5 | endpoint:
6 | quickfixjclient:
7 | enabled: true
8 | quickfixjserver:
9 | enabled: true
10 | endpoints:
11 | web:
12 | exposure:
13 | include: quickfixjclient,quickfixjserver
14 |
15 | logging:
16 | file:
17 | name: logs/client-and-server.log
18 | pattern:
19 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
20 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/src/main/resources/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/initiator
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=localhost
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=5
10 | ReconnectInterval=5
11 | FileLogPath=logs-client
12 | SocketKeyStorePassword=1234567890
13 | SocketTrustStorePassword=1234567890
14 |
15 | [session]
16 | BeginString=FIX.4.1
17 | SocketConnectPort=9877
18 |
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/acceptor
3 | ConnectionType=acceptor
4 | SenderCompID=EXEC
5 | TargetCompID=BANZAI
6 | StartTime=00:00:00
7 | EndTime=00:00:00
8 | HeartBtInt=5
9 | ReconnectInterval=5
10 | FileLogPath=logs-server
11 | SocketKeyStorePassword=1234567890
12 | SocketTrustStorePassword=1234567890
13 |
14 | [session]
15 | BeginString=FIX.4.1
16 | SocketAcceptPort=9877
17 |
--------------------------------------------------------------------------------
/simple-client-and-server-spring-3/src/main/resources/sender.http:
--------------------------------------------------------------------------------
1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection) or
2 | # paste cURL into the file and request will be converted to HTTP Request format.
3 | #
4 | # Following HTTP Request Live Templates are available:
5 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters;
6 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
7 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
8 |
9 | ### Send FIX.4.1 - OrderCancelRequest to client
10 | GET http://localhost:8089/send-client-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
11 |
12 | ### Send FIXT1.1 - Quote to client
13 | GET http://localhost:8089/send-client-message?fixVersion=FIXT.1.1&messageType=Quote
14 |
15 | ###
16 |
17 | ### Send FIX.4.1 - OrderCancelRequest to server
18 | GET http://localhost:8089/send-server-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
19 |
20 | ### Send FIXT1.1 - Quote to server
21 | GET http://localhost:8089/send-server-message?fixVersion=FIXT.1.1&messageType=Quote
22 |
23 | ###
--------------------------------------------------------------------------------
/simple-client-and-server/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | simple-client-and-server
11 | QuickFixJ Spring Boot Starter Examples :: Simple Client and Server
12 | QuickFixJ Spring Boot Starter Simple Client and Server
13 |
14 |
15 |
16 | org.springframework.boot
17 | spring-boot-starter-web
18 |
19 |
20 | io.allune
21 | quickfixj-spring-boot-starter
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/simple-client-and-server/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SenderController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.template.QuickFixJTemplate;
19 | import org.springframework.web.bind.annotation.RequestMapping;
20 | import org.springframework.web.bind.annotation.RequestParam;
21 | import org.springframework.web.bind.annotation.ResponseStatus;
22 | import org.springframework.web.bind.annotation.RestController;
23 | import quickfix.Acceptor;
24 | import quickfix.Initiator;
25 | import quickfix.Message;
26 | import quickfix.SessionID;
27 | import quickfix.StringField;
28 | import quickfix.field.ClOrdID;
29 | import quickfix.field.OrigClOrdID;
30 | import quickfix.field.QuoteID;
31 | import quickfix.field.Side;
32 | import quickfix.field.Symbol;
33 | import quickfix.field.Text;
34 |
35 | import java.util.HashMap;
36 | import java.util.Map;
37 |
38 | import static java.util.UUID.randomUUID;
39 | import static org.springframework.http.HttpStatus.OK;
40 | import static quickfix.FixVersions.BEGINSTRING_FIX41;
41 | import static quickfix.FixVersions.BEGINSTRING_FIXT11;
42 |
43 | @RestController
44 | public class SenderController {
45 |
46 | private static final Map> messageMap = createMessageMap();
47 |
48 | private final Acceptor serverAcceptor;
49 |
50 | private final QuickFixJTemplate quickFixJTemplate;
51 |
52 | private final Initiator clientInitiator;
53 |
54 | public SenderController(
55 | Acceptor serverAcceptor,
56 | QuickFixJTemplate quickFixJTemplate,
57 | Initiator clientInitiator) {
58 | this.serverAcceptor = serverAcceptor;
59 | this.quickFixJTemplate = quickFixJTemplate;
60 | this.clientInitiator = clientInitiator;
61 | }
62 |
63 | private static HashMap> createMessageMap() {
64 | HashMap> stringMapHashMap = new HashMap<>();
65 | stringMapHashMap.put(BEGINSTRING_FIX41, initialiseFix41MessageMap());
66 | stringMapHashMap.put(BEGINSTRING_FIXT11, initialiseFix50MessageMap());
67 | return stringMapHashMap;
68 | }
69 |
70 | private static Map initialiseFix41MessageMap() {
71 | Map messageMap = new HashMap<>();
72 | messageMap.put("OrderCancelRequest", new quickfix.fix41.OrderCancelRequest(
73 | new OrigClOrdID("123"),
74 | new ClOrdID("321"),
75 | new Symbol("LNUX"),
76 | new Side(Side.BUY)));
77 | return messageMap;
78 | }
79 |
80 | private static Map initialiseFix50MessageMap() {
81 | Map messageMap = new HashMap<>();
82 | messageMap.put("Quote", new quickfix.fix50.Quote(new QuoteID("123")));
83 | return messageMap;
84 | }
85 |
86 | @RequestMapping("/send-client-message")
87 | @ResponseStatus(OK)
88 | public void sendMessageToClient(@RequestParam String fixVersion, @RequestParam String messageType) {
89 | Map stringMessageMap = messageMap.get(fixVersion);
90 | Message message = stringMessageMap.get(messageType);
91 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
92 |
93 | SessionID sessionID = serverAcceptor.getSessions().stream()
94 | .filter(id -> id.getBeginString().equals(fixVersion))
95 | .findFirst()
96 | .orElseThrow(RuntimeException::new);
97 | quickFixJTemplate.send(message, sessionID);
98 | }
99 |
100 | @RequestMapping("/send-server-message")
101 | @ResponseStatus(OK)
102 | public void sendMessageToServer(@RequestParam String fixVersion, @RequestParam String messageType) {
103 |
104 | Map stringMessageMap = messageMap.get(fixVersion);
105 | Message message = stringMessageMap.get(messageType);
106 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
107 |
108 | SessionID sessionID = clientInitiator.getSessions().stream()
109 | .filter(id -> id.getBeginString().equals(fixVersion))
110 | .findFirst()
111 | .orElseThrow(RuntimeException::new);
112 | quickFixJTemplate.send(message, sessionID);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/simple-client-and-server/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SimpleClientAndServer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 |
23 | @EnableQuickFixJServer
24 | @EnableQuickFixJClient
25 | @SpringBootApplication
26 | public class SimpleClientAndServer {
27 |
28 | public static void main(String[] args) {
29 | SpringApplication.run(SimpleClientAndServer.class, args);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/simple-client-and-server/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8089
3 |
4 | management:
5 | endpoint:
6 | quickfixjclient:
7 | enabled: true
8 | quickfixjserver:
9 | enabled: true
10 | endpoints:
11 | web:
12 | exposure:
13 | include: quickfixjclient,quickfixjserver
14 |
15 | logging:
16 | file:
17 | name: logs/client-and-server.log
18 | pattern:
19 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
20 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
--------------------------------------------------------------------------------
/simple-client-and-server/src/main/resources/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/initiator
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=localhost
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=5
10 | ReconnectInterval=5
11 | FileLogPath=logs-client
12 |
13 | [session]
14 | BeginString=FIX.4.1
15 | SocketConnectPort=9877
16 |
17 |
--------------------------------------------------------------------------------
/simple-client-and-server/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/acceptor
3 | ConnectionType=acceptor
4 | SenderCompID=EXEC
5 | TargetCompID=BANZAI
6 | StartTime=00:00:00
7 | EndTime=00:00:00
8 | HeartBtInt=5
9 | ReconnectInterval=5
10 | FileLogPath=logs-server
11 |
12 | [session]
13 | BeginString=FIX.4.1
14 | SocketAcceptPort=9877
--------------------------------------------------------------------------------
/simple-client-and-server/src/main/resources/sender.http:
--------------------------------------------------------------------------------
1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection) or
2 | # paste cURL into the file and request will be converted to HTTP Request format.
3 | #
4 | # Following HTTP Request Live Templates are available:
5 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters;
6 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
7 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
8 |
9 | ### Send FIX.4.1 - OrderCancelRequest to client
10 | GET http://localhost:8089/send-client-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
11 |
12 | ### Send FIXT1.1 - Quote to client
13 | GET http://localhost:8089/send-client-message?fixVersion=FIXT.1.1&messageType=Quote
14 |
15 | ###
16 |
17 | ### Send FIX.4.1 - OrderCancelRequest to server
18 | GET http://localhost:8089/send-server-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
19 |
20 | ### Send FIXT1.1 - Quote to server
21 | GET http://localhost:8089/send-server-message?fixVersion=FIXT.1.1&messageType=Quote
22 |
23 | ###
--------------------------------------------------------------------------------
/simple-client-listener/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | simple-client-listener
11 | jar
12 |
13 | QuickFixJ Spring Boot Starter Examples :: Simple Client Listener
14 | QuickFixJ Spring Boot Starter Simple Client Listener
15 |
16 |
17 | UTF-8
18 | UTF-8
19 |
20 |
21 |
22 |
23 | io.allune
24 | quickfixj-spring-boot-starter
25 |
26 |
27 |
28 | io.allune
29 | quickfixj-spring-boot-actuator
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-web
35 |
36 |
37 |
38 | org.projectlombok
39 | lombok
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-starter-test
45 | test
46 |
47 |
48 |
49 |
50 | ${project.artifactId}
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-maven-plugin
55 |
56 |
57 |
58 | repackage
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/simple-client-listener/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/ApplicationListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.model.Create;
19 | import io.allune.quickfixj.spring.boot.starter.model.FromAdmin;
20 | import io.allune.quickfixj.spring.boot.starter.model.FromApp;
21 | import io.allune.quickfixj.spring.boot.starter.model.Logon;
22 | import io.allune.quickfixj.spring.boot.starter.model.Logout;
23 | import io.allune.quickfixj.spring.boot.starter.model.ToAdmin;
24 | import io.allune.quickfixj.spring.boot.starter.model.ToApp;
25 | import lombok.extern.slf4j.Slf4j;
26 | import org.springframework.context.event.EventListener;
27 | import org.springframework.stereotype.Component;
28 |
29 | @Slf4j
30 | @Component
31 | public class ApplicationListener {
32 |
33 | @EventListener
34 | public void handleFromAdmin1(FromAdmin fromAdmin) {
35 | log.info("fromAdmin: Message={}, SessionId={}", fromAdmin.getMessage(), fromAdmin.getSessionId());
36 | }
37 |
38 | @EventListener
39 | public void handleFromAdmin2(FromAdmin fromAdmin) {
40 | log.info("fromAdmin: Message={}, SessionId={}", fromAdmin.getMessage(), fromAdmin.getSessionId());
41 | }
42 |
43 | @EventListener
44 | public void handleFromApp(FromApp fromApp) {
45 | log.info("fromAdmin: Message={}, SessionId={}", fromApp.getMessage(), fromApp.getSessionId());
46 | }
47 |
48 | @EventListener
49 | public void handleCreate(Create create) {
50 | log.info("onCreate: SessionId={}", create.getSessionId());
51 | }
52 |
53 | @EventListener
54 | public void handleLogon(Logon logon) {
55 | log.info("onLogon: SessionId={}", logon.getSessionId());
56 | }
57 |
58 | @EventListener
59 | public void handleLogout(Logout logout) {
60 | log.info("onLogout: SessionId={}", logout.getSessionId());
61 | }
62 |
63 | @EventListener
64 | public void handleToAdmin(ToAdmin toAdmin) {
65 | log.info("toAdmin: SessionId={}", toAdmin.getSessionId());
66 | }
67 |
68 | @EventListener
69 | public void handleToApp(ToApp toApp) {
70 | log.info("toApp: SessionId={}", toApp.getSessionId());
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/simple-client-listener/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/SimpleClientListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import lombok.extern.slf4j.Slf4j;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 |
23 | @Slf4j
24 | @EnableQuickFixJClient
25 | @SpringBootApplication
26 | public class SimpleClientListener {
27 |
28 | public static void main(String[] args) {
29 | SpringApplication.run(SimpleClientListener.class, args);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/simple-client-listener/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | quickfixj:
2 | client:
3 | config: ${QUIICKFIXJ_CLIENT_CONFIG_FILE:classpath:quickfixj-client.cfg}
4 | jmx-enabled: true
5 |
6 | server:
7 | port: 8081
8 |
9 | management:
10 | endpoint:
11 | quickfixjclient:
12 | enabled: true
13 | endpoints:
14 | web:
15 | exposure:
16 | include: quickfixjclient
17 |
18 | logging:
19 | file:
20 | name: logs/client-listener.log
21 | pattern:
22 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
23 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
--------------------------------------------------------------------------------
/simple-client-listener/src/main/resources/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/banzai
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=localhost
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=30
10 | ReconnectInterval=5
11 |
12 | [session]
13 | BeginString=FIX.4.0
14 | SocketConnectPort=9876
15 |
16 | [session]
17 | BeginString=FIX.4.1
18 | SocketConnectPort=9877
19 |
20 | [session]
21 | BeginString=FIX.4.2
22 | SocketConnectPort=9878
23 |
24 | [session]
25 | BeginString=FIX.4.3
26 | SocketConnectPort=9879
27 |
28 | [session]
29 | BeginString=FIX.4.4
30 | SocketConnectPort=9880
31 |
32 | [session]
33 | BeginString=FIXT.1.1
34 | DefaultApplVerID=FIX.5.0
35 | SocketConnectPort=9881
36 |
--------------------------------------------------------------------------------
/simple-client-spring-3/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-client-spring-3
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Client Spring 3
15 | QuickFixJ Spring Boot Starter Simple Client Spring 3
16 |
17 |
18 | UTF-8
19 | UTF-8
20 | 17
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-dependencies
30 | 3.2.2
31 | pom
32 | import
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | io.allune
41 | quickfixj-spring-boot-starter
42 |
43 |
44 |
45 | io.allune
46 | quickfixj-spring-boot-actuator
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-starter-web
52 |
53 |
54 |
55 | org.springframework.boot
56 | spring-boot-starter-test
57 | test
58 |
59 |
60 |
61 | org.projectlombok
62 | lombok
63 |
64 |
65 |
66 |
67 | ${project.artifactId}
68 |
69 |
70 | org.springframework.boot
71 | spring-boot-maven-plugin
72 |
73 |
74 |
75 | repackage
76 |
77 |
78 |
79 |
80 |
81 | org.apache.maven.plugins
82 | maven-compiler-plugin
83 | 3.3
84 |
85 | 17
86 | 17
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/simple-client-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/ApplicationMessageCracker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import lombok.extern.slf4j.Slf4j;
19 | import quickfix.FieldNotFound;
20 | import quickfix.IncorrectTagValue;
21 | import quickfix.SessionID;
22 | import quickfix.UnsupportedMessageType;
23 | import quickfix.fix41.MessageCracker;
24 |
25 | @Slf4j
26 | public class ApplicationMessageCracker extends MessageCracker {
27 |
28 | @Override
29 | public void onMessage(quickfix.fix41.OrderCancelRequest orderCancelRequest, SessionID sessionID)
30 | throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
31 |
32 | // Handle the message here
33 | log.info("*****************");
34 | log.info("Message received for sessionID={}: {}", sessionID, orderCancelRequest);
35 | log.info("*****************");
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/simple-client-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/ClientApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.FieldNotFound;
22 | import quickfix.IncorrectTagValue;
23 | import quickfix.Message;
24 | import quickfix.SessionID;
25 | import quickfix.UnsupportedMessageType;
26 | import quickfix.fix41.MessageCracker;
27 |
28 | public class ClientApplicationAdapter implements Application {
29 |
30 | private static final Logger log = LoggerFactory.getLogger(ClientApplicationAdapter.class);
31 |
32 | private final MessageCracker messageCracker;
33 |
34 | public ClientApplicationAdapter(MessageCracker messageCracker) {
35 | this.messageCracker = messageCracker;
36 | }
37 |
38 | @Override
39 | public void fromAdmin(Message message, SessionID sessionId) {
40 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
41 | }
42 |
43 | @Override
44 | public void fromApp(Message message, SessionID sessionId) {
45 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
46 |
47 | try {
48 | messageCracker.crack(message, sessionId);
49 | } catch (UnsupportedMessageType | FieldNotFound | IncorrectTagValue e) {
50 | log.error(e.getMessage(), e);
51 | }
52 | }
53 |
54 | @Override
55 | public void onCreate(SessionID sessionId) {
56 | log.info("onCreate: SessionId={}", sessionId);
57 | }
58 |
59 | @Override
60 | public void onLogon(SessionID sessionId) {
61 | log.info("onLogon: SessionId={}", sessionId);
62 | }
63 |
64 | @Override
65 | public void onLogout(SessionID sessionId) {
66 | log.info("onLogout: SessionId={}", sessionId);
67 | }
68 |
69 | @Override
70 | public void toAdmin(Message message, SessionID sessionId) {
71 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
72 | }
73 |
74 | @Override
75 | public void toApp(Message message, SessionID sessionId) {
76 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/simple-client-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/SimpleClientSpring3.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import lombok.extern.slf4j.Slf4j;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 | import org.springframework.context.annotation.Bean;
23 | import quickfix.Application;
24 | import quickfix.FileLogFactory;
25 | import quickfix.LogFactory;
26 | import quickfix.SessionSettings;
27 | import quickfix.fix41.MessageCracker;
28 |
29 | @Slf4j
30 | @EnableQuickFixJClient
31 | @SpringBootApplication
32 | public class SimpleClientSpring3 {
33 |
34 | public static void main(String[] args) {
35 | SpringApplication.run(SimpleClientSpring3.class, args);
36 | }
37 |
38 | @Bean
39 | public Application clientApplication(MessageCracker messageCracker) {
40 | return new ClientApplicationAdapter(messageCracker);
41 | }
42 |
43 | @Bean
44 | public MessageCracker messageCracker() {
45 | return new ApplicationMessageCracker();
46 | }
47 |
48 | // @Bean
49 | // public Initiator clientInitiator(
50 | // Application clientApplication,
51 | // MessageStoreFactory clientMessageStoreFactory,
52 | // SessionSettings clientSessionSettings,
53 | // LogFactory clientLogFactory,
54 | // MessageFactory clientMessageFactory) throws ConfigError {
55 | //
56 | // return new ThreadedSocketInitiator(clientApplication, clientMessageStoreFactory, clientSessionSettings,
57 | // clientLogFactory, clientMessageFactory);
58 | // }
59 |
60 | @Bean
61 | public LogFactory clientLogFactory(SessionSettings clientSessionSettings) {
62 | return new FileLogFactory(clientSessionSettings);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/simple-client-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/TestController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import lombok.extern.slf4j.Slf4j;
19 | import org.springframework.web.bind.annotation.GetMapping;
20 | import org.springframework.web.bind.annotation.RequestMapping;
21 | import org.springframework.web.bind.annotation.RestController;
22 |
23 | @Slf4j
24 | @RequestMapping("/fix")
25 | @RestController
26 | public class TestController {
27 |
28 | @GetMapping("/test")
29 | public String test() throws Exception {
30 | log.info("test");
31 | return "success";
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/simple-client-spring-3/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | client:
7 | config: ${QUIICKFIXJ_CLIENT_CONFIG_FILE:classpath:quickfixj-client.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8081
12 |
13 | management:
14 | endpoint:
15 | quickfixjclient:
16 | enabled: true
17 | endpoints:
18 | web:
19 | exposure:
20 | include: quickfixjclient
21 |
22 | logging:
23 | file:
24 | name: logs/client.log
25 | pattern:
26 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
27 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
28 |
--------------------------------------------------------------------------------
/simple-client-spring-3/src/main/resources/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/banzai
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=localhost
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=30
10 | ReconnectInterval=5
11 | FileLogPath=logs-client
12 |
13 | [session]
14 | BeginString=FIX.4.0
15 | SocketConnectPort=9876
16 |
17 | [session]
18 | BeginString=FIX.4.1
19 | SocketConnectPort=9877
20 |
21 | [session]
22 | BeginString=FIX.4.2
23 | SocketConnectPort=9878
24 |
25 | [session]
26 | BeginString=FIX.4.3
27 | SocketConnectPort=9879
28 |
29 | [session]
30 | BeginString=FIX.4.4
31 | SocketConnectPort=9880
32 |
33 | [session]
34 | BeginString=FIXT.1.1
35 | DefaultApplVerID=FIX.5.0
36 | SocketConnectPort=9881
37 |
--------------------------------------------------------------------------------
/simple-client-with-database/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-client-with-database
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Client with Database
15 | QuickFixJ Spring Boot Starter Simple Client with Database Example
16 |
17 |
18 | UTF-8
19 | UTF-8
20 |
21 |
22 |
23 |
24 | docker
25 |
26 |
27 | mysql
28 | mysql-connector-java
29 |
30 |
31 |
32 |
33 |
34 | !docker
35 |
36 | true
37 |
38 |
39 |
40 | org.hsqldb
41 | hsqldb
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | io.allune
50 | quickfixj-spring-boot-starter
51 |
52 |
53 | proxool
54 | proxool
55 |
56 |
57 |
58 |
59 |
60 | io.allune
61 | quickfixj-spring-boot-actuator
62 |
63 |
64 | proxool
65 | proxool
66 |
67 |
68 |
69 |
70 |
71 | org.springframework.boot
72 | spring-boot-starter-web
73 |
74 |
75 |
76 | org.springframework.boot
77 | spring-boot-starter-jdbc
78 |
79 |
80 |
81 | org.apache.commons
82 | commons-dbcp2
83 |
84 |
85 |
86 | org.projectlombok
87 | lombok
88 |
89 |
90 |
91 | org.springframework.boot
92 | spring-boot-starter-test
93 | test
94 |
95 |
96 |
97 |
98 | ${project.artifactId}
99 |
100 |
101 | org.springframework.boot
102 | spring-boot-maven-plugin
103 |
104 |
105 |
106 | repackage
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/ClientApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.Message;
22 | import quickfix.SessionID;
23 |
24 | public class ClientApplicationAdapter implements Application {
25 |
26 | private static final Logger log = LoggerFactory.getLogger(ClientApplicationAdapter.class);
27 |
28 | @Override
29 | public void fromAdmin(Message message, SessionID sessionId) {
30 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
31 | }
32 |
33 | @Override
34 | public void fromApp(Message message, SessionID sessionId) {
35 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
36 | }
37 |
38 | @Override
39 | public void onCreate(SessionID sessionId) {
40 | log.info("onCreate: SessionId={}", sessionId);
41 | }
42 |
43 | @Override
44 | public void onLogon(SessionID sessionId) {
45 | log.info("onLogon: SessionId={}", sessionId);
46 | }
47 |
48 | @Override
49 | public void onLogout(SessionID sessionId) {
50 | log.info("onLogout: SessionId={}", sessionId);
51 | }
52 |
53 | @Override
54 | public void toAdmin(Message message, SessionID sessionId) {
55 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
56 | }
57 |
58 | @Override
59 | public void toApp(Message message, SessionID sessionId) {
60 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/DbConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import org.apache.commons.dbcp2.BasicDataSource;
19 | import org.springframework.beans.factory.annotation.Value;
20 | import org.springframework.context.annotation.Bean;
21 | import org.springframework.context.annotation.Configuration;
22 | import org.springframework.context.annotation.Primary;
23 | import org.springframework.context.annotation.Profile;
24 | import org.springframework.core.io.Resource;
25 | import org.springframework.jdbc.datasource.init.DataSourceInitializer;
26 | import org.springframework.jdbc.datasource.init.DatabasePopulator;
27 | import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
28 |
29 | import javax.sql.DataSource;
30 |
31 | @Profile("!docker")
32 | @Configuration
33 | public class DbConfiguration {
34 |
35 | @Value("classpath:hsqldb/data.sql")
36 | private Resource dataScript;
37 |
38 | @Bean
39 | @Primary
40 | public DataSource dataSource() {
41 | BasicDataSource datasource = new BasicDataSource();
42 | datasource.setDriverClassName("org.hsqldb.jdbcDriver");
43 | datasource.setUrl("jdbc:hsqldb:file:./db/data;hsqldb.lock_file=false");
44 | datasource.setUsername("sa");
45 | datasource.setPassword("");
46 | return datasource;
47 | }
48 |
49 | @Bean
50 | public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
51 | final DataSourceInitializer initializer = new DataSourceInitializer();
52 | initializer.setDataSource(dataSource);
53 | initializer.setDatabasePopulator(databasePopulator());
54 | return initializer;
55 | }
56 |
57 | private DatabasePopulator databasePopulator() {
58 | final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
59 | populator.addScript(dataScript);
60 | return populator;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/SimpleClientWithDatabase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import lombok.extern.slf4j.Slf4j;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 | import org.springframework.context.annotation.Bean;
23 | import quickfix.Application;
24 | import quickfix.ConfigError;
25 | import quickfix.Initiator;
26 | import quickfix.JdbcLogFactory;
27 | import quickfix.JdbcStoreFactory;
28 | import quickfix.LogFactory;
29 | import quickfix.MessageFactory;
30 | import quickfix.MessageStoreFactory;
31 | import quickfix.SessionSettings;
32 | import quickfix.ThreadedSocketInitiator;
33 |
34 | import javax.sql.DataSource;
35 |
36 | @Slf4j
37 | @EnableQuickFixJClient
38 | @SpringBootApplication
39 | public class SimpleClientWithDatabase {
40 |
41 | public static void main(String[] args) {
42 | SpringApplication.run(SimpleClientWithDatabase.class, args);
43 | }
44 |
45 | @Bean
46 | public Application clientApplication() {
47 | return new ClientApplicationAdapter();
48 | }
49 |
50 | @Bean
51 | public Initiator clientInitiator(quickfix.Application clientApplication, MessageStoreFactory clientMessageStoreFactory,
52 | SessionSettings clientSessionSettings, LogFactory clientLogFactory,
53 | MessageFactory clientMessageFactory) throws ConfigError {
54 |
55 | return new ThreadedSocketInitiator(clientApplication, clientMessageStoreFactory, clientSessionSettings,
56 | clientLogFactory, clientMessageFactory);
57 | }
58 |
59 | @Bean
60 | public MessageStoreFactory clientMessageStoreFactory(SessionSettings clientSessionSettings, DataSource dataSource) {
61 | JdbcStoreFactory jdbcStoreFactory = new JdbcStoreFactory(clientSessionSettings);
62 | jdbcStoreFactory.setDataSource(dataSource);
63 | return jdbcStoreFactory;
64 | }
65 |
66 | @Bean
67 | public LogFactory clientLogFactory(SessionSettings clientSessionSettings, DataSource dataSource) {
68 | JdbcLogFactory jdbcLogFactory = new JdbcLogFactory(clientSessionSettings);
69 | jdbcLogFactory.setDataSource(dataSource);
70 | return jdbcLogFactory;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | client:
7 | config: ${QUIICKFIXJ_CLIENT_CONFIG_FILE:classpath:quickfixj-client.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8081
12 |
13 | management:
14 | endpoint:
15 | quickfixjclient:
16 | enabled: true
17 | endpoints:
18 | web:
19 | exposure:
20 | include: quickfixjclient
21 |
22 | logging:
23 | file:
24 | name: logs/client-with-database.log
25 | pattern:
26 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
27 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
28 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/resources/hsqldb/data.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE messages IF EXISTS;
2 | DROP TABLE messages_log IF EXISTS;
3 | DROP TABLE event_log IF EXISTS;
4 | DROP TABLE sessions IF EXISTS;
5 |
6 | CREATE TABLE messages
7 | (
8 | beginstring CHAR(8) NOT NULL,
9 | sendercompid VARCHAR(64) NOT NULL,
10 | sendersubid VARCHAR(64) NOT NULL,
11 | senderlocid VARCHAR(64) NOT NULL,
12 | targetcompid VARCHAR(64) NOT NULL,
13 | targetsubid VARCHAR(64) NOT NULL,
14 | targetlocid VARCHAR(64) NOT NULL,
15 | session_qualifier VARCHAR(64) NOT NULL,
16 | msgseqnum INT NOT NULL,
17 | message VARCHAR(2048) NOT NULL,
18 | PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
19 | targetcompid, targetsubid, targetlocid, session_qualifier,
20 | msgseqnum)
21 | );
22 |
23 | CREATE TABLE messages_log
24 | (
25 | id INT IDENTITY PRIMARY KEY,
26 | time DATETIME NOT NULL,
27 | beginstring CHAR(8) NOT NULL,
28 | sendercompid VARCHAR(64) NOT NULL,
29 | sendersubid VARCHAR(64) NOT NULL,
30 | senderlocid VARCHAR(64) NOT NULL,
31 | targetcompid VARCHAR(64) NOT NULL,
32 | targetsubid VARCHAR(64) NOT NULL,
33 | targetlocid VARCHAR(64) NOT NULL,
34 | session_qualifier VARCHAR(64) NOT NULL,
35 | text VARCHAR(2048) NOT NULL
36 | );
37 |
38 | CREATE TABLE event_log
39 | (
40 | id INT IDENTITY PRIMARY KEY,
41 | time DATETIME NOT NULL,
42 | beginstring CHAR(8) NOT NULL,
43 | sendercompid VARCHAR(64) NOT NULL,
44 | sendersubid VARCHAR(64) NOT NULL,
45 | senderlocid VARCHAR(64) NOT NULL,
46 | targetcompid VARCHAR(64) NOT NULL,
47 | targetsubid VARCHAR(64) NOT NULL,
48 | targetlocid VARCHAR(64) NOT NULL,
49 | session_qualifier VARCHAR(64),
50 | text VARCHAR(2048) NOT NULL
51 | );
52 |
53 | CREATE TABLE sessions
54 | (
55 | beginstring CHAR(8) NOT NULL,
56 | sendercompid VARCHAR(64) NOT NULL,
57 | sendersubid VARCHAR(64) NOT NULL,
58 | senderlocid VARCHAR(64) NOT NULL,
59 | targetcompid VARCHAR(64) NOT NULL,
60 | targetsubid VARCHAR(64) NOT NULL,
61 | targetlocid VARCHAR(64) NOT NULL,
62 | session_qualifier VARCHAR(64) NOT NULL,
63 | creation_time DATETIME NOT NULL,
64 | incoming_seqnum INT NOT NULL,
65 | outgoing_seqnum INT NOT NULL,
66 | PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
67 | targetcompid, targetsubid, targetlocid, session_qualifier)
68 | );
69 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Loggers
3 | #
4 | # Catch-all
5 | log4j.rootLogger=INFO, ROOT
6 | # Repeat for each session...
7 | log4j.logger.EXEC.BANZAI=INFO, EXEC_BANZAI
8 | log4j.additivity.EXEC.BANZAI=false
9 | log4j.logger.EXEC.BANZAI.events=INFO, EXEC_BANZAI_EV
10 | log4j.additivity.EXEC.BANZAI.events=false
11 | #
12 | # Appenders
13 | #
14 | log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
15 | log4j.appender.ROOT.File=log/QuickFixJ-root.log
16 | log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
17 | log4j.appender.ROOT.layout.ConversionPattern=%d{DATE} %p [%t] %c - %m %n
18 | log4j.appender.ROOT.MaxFileSize=500KB
19 | log4j.appender.ROOT.MaxBackupIndex=3
20 | # Repeat for each session...
21 | log4j.appender.EXEC_BANZAI=org.apache.log4j.DailyRollingFileAppender
22 | log4j.appender.EXEC_BANZAI.DatePattern='.'yyyy-MM-dd
23 | log4j.appender.EXEC_BANZAI.File=log/EXEC-BANZAI.messages.log
24 | log4j.appender.EXEC_BANZAI.layout=org.apache.log4j.PatternLayout
25 | log4j.appender.EXEC_BANZAI.layout.ConversionPattern=%m%n
26 | log4j.appender.EXEC_BANZAI_EV=org.apache.log4j.DailyRollingFileAppender
27 | log4j.appender.EXEC_BANZAI_EV.DatePattern='.'yyyy-MM-dd
28 | log4j.appender.EXEC_BANZAI_EV.File=log/EXEC-BANZAI.events.log
29 | log4j.appender.EXEC_BANZAI_EV.layout=org.apache.log4j.PatternLayout
30 | log4j.appender.EXEC_BANZAI_EV.layout.ConversionPattern=%d{DATE}: %m%n
31 |
--------------------------------------------------------------------------------
/simple-client-with-database/src/main/resources/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=data/messenger/initiator
3 | FileLogPath=logs-client
4 | ConnectionType=initiator
5 | SenderCompID=BANZAI
6 | TargetCompID=EXEC
7 | SocketConnectHost=localhost
8 | StartTime=00:00:00
9 | EndTime=00:00:00
10 | HeartBtInt=30
11 | ReconnectInterval=5
12 |
13 | JdbcDriver=org.hsqldb.jdbc.JDBCDriver
14 | JdbcURL=jdbc:hsqldb:file:./db/data;hsqldb.lock_file=false
15 | JdbcUser=sa
16 | JdbcPassword=
17 | JdbcLogHeartBeats=Y
18 | JdbcStoreMessagesTableName=messages
19 | JdbcStoreSessionsTableName=sessions
20 | JdbcLogEventTable=event_log
21 | JdbcLogIncomingTable=messages_log
22 | JdbcLogOutgoingTable=messages_log
23 | JdbcSessionIdDefaultPropertyValue=not_null
24 |
25 | [session]
26 | BeginString=FIX.4.0
27 | SocketConnectPort=9876
28 |
29 | [session]
30 | BeginString=FIX.4.1
31 | SocketConnectPort=9877
32 |
33 | [session]
34 | BeginString=FIX.4.2
35 | SocketConnectPort=9878
36 |
37 | [session]
38 | BeginString=FIX.4.3
39 | SocketConnectPort=9879
40 |
41 | [session]
42 | BeginString=FIX.4.4
43 | SocketConnectPort=9880
44 |
45 | [session]
46 | BeginString=FIXT.1.1
47 | DefaultApplVerID=FIX.5.0
48 | SocketConnectPort=9881
49 |
--------------------------------------------------------------------------------
/simple-client/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-client
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Client
15 | QuickFixJ Spring Boot Starter Simple Client
16 |
17 |
18 | UTF-8
19 | UTF-8
20 |
21 |
22 |
23 |
24 | io.allune
25 | quickfixj-spring-boot-starter
26 |
27 |
28 |
29 | io.allune
30 | quickfixj-spring-boot-actuator
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-web
36 |
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-starter-test
41 | test
42 |
43 |
44 |
45 | org.projectlombok
46 | lombok
47 |
48 |
49 |
50 |
51 | ${project.artifactId}
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-maven-plugin
56 |
57 |
58 |
59 | repackage
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/simple-client/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/ApplicationMessageCracker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import lombok.extern.slf4j.Slf4j;
19 | import quickfix.FieldNotFound;
20 | import quickfix.IncorrectTagValue;
21 | import quickfix.SessionID;
22 | import quickfix.UnsupportedMessageType;
23 | import quickfix.fix41.MessageCracker;
24 |
25 | @Slf4j
26 | public class ApplicationMessageCracker extends MessageCracker {
27 |
28 | @Override
29 | public void onMessage(quickfix.fix41.OrderCancelRequest orderCancelRequest, SessionID sessionID)
30 | throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
31 |
32 | // Handle the message here
33 | log.info("*****************");
34 | log.info("Message received for sessionID={}: {}", sessionID, orderCancelRequest);
35 | log.info("*****************");
36 | }
37 | }
--------------------------------------------------------------------------------
/simple-client/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/ClientApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.FieldNotFound;
22 | import quickfix.IncorrectTagValue;
23 | import quickfix.Message;
24 | import quickfix.SessionID;
25 | import quickfix.UnsupportedMessageType;
26 | import quickfix.fix41.MessageCracker;
27 |
28 | public class ClientApplicationAdapter implements Application {
29 |
30 | private static final Logger log = LoggerFactory.getLogger(ClientApplicationAdapter.class);
31 |
32 | private final MessageCracker messageCracker;
33 |
34 | public ClientApplicationAdapter(MessageCracker messageCracker) {
35 | this.messageCracker = messageCracker;
36 | }
37 |
38 | @Override
39 | public void fromAdmin(Message message, SessionID sessionId) {
40 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
41 | }
42 |
43 | @Override
44 | public void fromApp(Message message, SessionID sessionId) {
45 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
46 |
47 | try {
48 | messageCracker.crack(message, sessionId);
49 | } catch (UnsupportedMessageType | FieldNotFound | IncorrectTagValue e) {
50 | log.error(e.getMessage(), e);
51 | }
52 | }
53 |
54 | @Override
55 | public void onCreate(SessionID sessionId) {
56 | log.info("onCreate: SessionId={}", sessionId);
57 | }
58 |
59 | @Override
60 | public void onLogon(SessionID sessionId) {
61 | log.info("onLogon: SessionId={}", sessionId);
62 | }
63 |
64 | @Override
65 | public void onLogout(SessionID sessionId) {
66 | log.info("onLogout: SessionId={}", sessionId);
67 | }
68 |
69 | @Override
70 | public void toAdmin(Message message, SessionID sessionId) {
71 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
72 | }
73 |
74 | @Override
75 | public void toApp(Message message, SessionID sessionId) {
76 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/simple-client/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/SimpleClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient;
19 | import lombok.extern.slf4j.Slf4j;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 | import org.springframework.context.annotation.Bean;
23 | import quickfix.Application;
24 | import quickfix.ConfigError;
25 | import quickfix.FileLogFactory;
26 | import quickfix.Initiator;
27 | import quickfix.LogFactory;
28 | import quickfix.MessageFactory;
29 | import quickfix.MessageStoreFactory;
30 | import quickfix.SessionSettings;
31 | import quickfix.ThreadedSocketInitiator;
32 | import quickfix.fix41.MessageCracker;
33 |
34 | @Slf4j
35 | @EnableQuickFixJClient
36 | @SpringBootApplication
37 | public class SimpleClient {
38 |
39 | public static void main(String[] args) {
40 | SpringApplication.run(SimpleClient.class, args);
41 | }
42 |
43 | @Bean
44 | public Application clientApplication(MessageCracker messageCracker) {
45 | return new ClientApplicationAdapter(messageCracker);
46 | }
47 |
48 | @Bean
49 | public MessageCracker messageCracker() {
50 | return new ApplicationMessageCracker();
51 | }
52 |
53 | @Bean
54 | public Initiator clientInitiator(
55 | Application clientApplication,
56 | MessageStoreFactory clientMessageStoreFactory,
57 | SessionSettings clientSessionSettings,
58 | LogFactory clientLogFactory,
59 | MessageFactory clientMessageFactory) throws ConfigError {
60 |
61 | return new ThreadedSocketInitiator(clientApplication, clientMessageStoreFactory, clientSessionSettings,
62 | clientLogFactory, clientMessageFactory);
63 | }
64 |
65 | @Bean
66 | public LogFactory clientLogFactory(SessionSettings clientSessionSettings) {
67 | return new FileLogFactory(clientSessionSettings);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/simple-client/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/client/TestController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.client;
17 |
18 | import lombok.extern.slf4j.Slf4j;
19 | import org.springframework.web.bind.annotation.GetMapping;
20 | import org.springframework.web.bind.annotation.RequestMapping;
21 | import org.springframework.web.bind.annotation.RestController;
22 |
23 | @Slf4j
24 | @RequestMapping("/fix")
25 | @RestController
26 | public class TestController {
27 |
28 | @GetMapping("/test")
29 | public String test() throws Exception {
30 | log.info("test");
31 | return "success";
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/simple-client/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | client:
7 | config: ${QUIICKFIXJ_CLIENT_CONFIG_FILE:classpath:quickfixj-client.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8081
12 |
13 | management:
14 | endpoint:
15 | health:
16 | show-details: always
17 | quickfixjclient:
18 | enabled: true
19 | health:
20 | quickfixjserver:
21 | enabled: true
22 | endpoints:
23 | web:
24 | exposure:
25 | include: quickfixjclient,health
26 |
27 | logging:
28 | file:
29 | name: logs/client.log
30 | pattern:
31 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
32 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
33 |
--------------------------------------------------------------------------------
/simple-client/src/main/resources/quickfixj-client.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/banzai
3 | ConnectionType=initiator
4 | SenderCompID=BANZAI
5 | TargetCompID=EXEC
6 | SocketConnectHost=localhost
7 | StartTime=00:00:00
8 | EndTime=00:00:00
9 | HeartBtInt=30
10 | ReconnectInterval=5
11 | FileLogPath=logs-client
12 |
13 | [session]
14 | BeginString=FIX.4.0
15 | SocketConnectPort=9876
16 |
17 | [session]
18 | BeginString=FIX.4.1
19 | SocketConnectPort=9877
20 |
21 | [session]
22 | BeginString=FIX.4.2
23 | SocketConnectPort=9878
24 |
25 | [session]
26 | BeginString=FIX.4.3
27 | SocketConnectPort=9879
28 |
29 | [session]
30 | BeginString=FIX.4.4
31 | SocketConnectPort=9880
32 |
33 | [session]
34 | BeginString=FIXT.1.1
35 | DefaultApplVerID=FIX.5.0
36 | SocketConnectPort=9881
37 |
--------------------------------------------------------------------------------
/simple-server-dynamic-sessions/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-server-dynamic-sessions
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Server Dynamic Sessions
15 | QuickFixJ Spring Boot Starter Server with Dynamic Sessions Example
16 |
17 |
18 | UTF-8
19 | UTF-8
20 |
21 |
22 |
23 |
24 | io.allune
25 | quickfixj-spring-boot-starter
26 |
27 |
28 |
29 | io.allune
30 | quickfixj-spring-boot-actuator
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-web
36 |
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-starter-test
41 | test
42 |
43 |
44 |
45 |
46 | ${project.artifactId}
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-maven-plugin
51 |
52 |
53 |
54 | repackage
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/simple-server-dynamic-sessions/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/ServerApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.Message;
22 | import quickfix.SessionID;
23 |
24 | public class ServerApplicationAdapter implements Application {
25 |
26 | private static final Logger log = LoggerFactory.getLogger(ServerApplicationAdapter.class);
27 |
28 | @Override
29 | public void fromAdmin(Message message, SessionID sessionId) {
30 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
31 | }
32 |
33 | @Override
34 | public void fromApp(Message message, SessionID sessionId) {
35 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
36 | }
37 |
38 | @Override
39 | public void onCreate(SessionID sessionId) {
40 | log.info("onCreate: SessionId={}", sessionId);
41 | }
42 |
43 | @Override
44 | public void onLogon(SessionID sessionId) {
45 | log.info("onLogon: SessionId={}", sessionId);
46 | }
47 |
48 | @Override
49 | public void onLogout(SessionID sessionId) {
50 | log.info("onLogout: SessionId={}", sessionId);
51 | }
52 |
53 | @Override
54 | public void toAdmin(Message message, SessionID sessionId) {
55 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
56 | }
57 |
58 | @Override
59 | public void toApp(Message message, SessionID sessionId) {
60 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
61 | }
62 | }
--------------------------------------------------------------------------------
/simple-server-dynamic-sessions/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/SimpleServerDynamicSessions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
19 | import org.springframework.boot.SpringApplication;
20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
21 | import org.springframework.context.annotation.Bean;
22 | import quickfix.Acceptor;
23 | import quickfix.Application;
24 | import quickfix.ConfigError;
25 | import quickfix.FileLogFactory;
26 | import quickfix.FileStoreFactory;
27 | import quickfix.LogFactory;
28 | import quickfix.MessageFactory;
29 | import quickfix.MessageStoreFactory;
30 | import quickfix.SessionID;
31 | import quickfix.SessionSettings;
32 | import quickfix.ThreadedSocketAcceptor;
33 | import quickfix.mina.acceptor.DynamicAcceptorSessionProvider;
34 |
35 | import java.net.InetSocketAddress;
36 |
37 | import static quickfix.Acceptor.SETTING_ACCEPTOR_TEMPLATE;
38 | import static quickfix.FixVersions.BEGINSTRING_FIX40;
39 | import static quickfix.FixVersions.BEGINSTRING_FIX44;
40 | import static quickfix.SessionSettings.BEGINSTRING;
41 | import static quickfix.mina.acceptor.DynamicAcceptorSessionProvider.WILDCARD;
42 |
43 | @EnableQuickFixJServer
44 | @SpringBootApplication
45 | public class SimpleServerDynamicSessions {
46 |
47 | public static void main(String[] args) {
48 | SpringApplication.run(SimpleServerDynamicSessions.class, args);
49 | }
50 |
51 | @Bean
52 | public Application serverApplication() {
53 | return new ServerApplicationAdapter();
54 | }
55 |
56 | @Bean
57 | public Acceptor serverAcceptor(quickfix.Application serverApplication, MessageStoreFactory serverMessageStoreFactory,
58 | SessionSettings serverSessionSettings, LogFactory serverLogFactory,
59 | MessageFactory serverMessageFactory) throws ConfigError {
60 |
61 | ThreadedSocketAcceptor threadedSocketAcceptor = new ThreadedSocketAcceptor(serverApplication, serverMessageStoreFactory, serverSessionSettings,
62 | serverLogFactory, serverMessageFactory);
63 |
64 | final SessionID anySession = new SessionID(BEGINSTRING_FIX40, WILDCARD, WILDCARD);
65 | serverSessionSettings.setBool(anySession, SETTING_ACCEPTOR_TEMPLATE, true);
66 | serverSessionSettings.setString(anySession, BEGINSTRING, BEGINSTRING_FIX44);
67 | threadedSocketAcceptor.setSessionProvider(
68 | new InetSocketAddress("0.0.0.0", 9876),
69 | new DynamicAcceptorSessionProvider(serverSessionSettings, anySession, serverApplication, serverMessageStoreFactory,
70 | serverLogFactory, serverMessageFactory)
71 | );
72 | return threadedSocketAcceptor;
73 | }
74 |
75 | @Bean
76 | public MessageStoreFactory serverMessageStoreFactory(SessionSettings serverSessionSettings) {
77 | return new FileStoreFactory(serverSessionSettings);
78 | }
79 |
80 | @Bean
81 | public LogFactory serverLogFactory(SessionSettings serverSessionSettings) {
82 | return new FileLogFactory(serverSessionSettings);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/simple-server-dynamic-sessions/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | server:
7 | config: ${QUICKFIXJ_SERVER_CONFIG_FILE:classpath:quickfixj-server.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8080
12 |
13 | management:
14 | endpoint:
15 | quickfixjserver:
16 | enabled: true
17 | endpoints:
18 | web:
19 | exposure:
20 | include: quickfixjserver
21 |
22 | logging:
23 | file:
24 | name: logs/server-dynamic-sessions.log
25 | pattern:
26 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
27 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
28 |
--------------------------------------------------------------------------------
/simple-server-dynamic-sessions/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Loggers
3 | #
4 | # Catch-all
5 | log4j.rootLogger=INFO, ROOT
6 | # Repeat for each session...
7 | log4j.logger.EXEC.BANZAI=INFO, EXEC_BANZAI
8 | log4j.additivity.EXEC.BANZAI=false
9 | log4j.logger.EXEC.BANZAI.events=INFO, EXEC_BANZAI_EV
10 | log4j.additivity.EXEC.BANZAI.events=false
11 | #
12 | # Appenders
13 | #
14 | log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
15 | log4j.appender.ROOT.File=log/QuickFixJ-root.log
16 | log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
17 | log4j.appender.ROOT.layout.ConversionPattern=%d{DATE} %p [%t] %c - %m %n
18 | log4j.appender.ROOT.MaxFileSize=500KB
19 | log4j.appender.ROOT.MaxBackupIndex=3
20 | # Repeat for each session...
21 | log4j.appender.EXEC_BANZAI=org.apache.log4j.DailyRollingFileAppender
22 | log4j.appender.EXEC_BANZAI.DatePattern='.'yyyy-MM-dd
23 | log4j.appender.EXEC_BANZAI.File=log/EXEC-BANZAI.messages.log
24 | log4j.appender.EXEC_BANZAI.layout=org.apache.log4j.PatternLayout
25 | log4j.appender.EXEC_BANZAI.layout.ConversionPattern=%m%n
26 | log4j.appender.EXEC_BANZAI_EV=org.apache.log4j.DailyRollingFileAppender
27 | log4j.appender.EXEC_BANZAI_EV.DatePattern='.'yyyy-MM-dd
28 | log4j.appender.EXEC_BANZAI_EV.File=log/EXEC-BANZAI.events.log
29 | log4j.appender.EXEC_BANZAI_EV.layout=org.apache.log4j.PatternLayout
30 | log4j.appender.EXEC_BANZAI_EV.layout.ConversionPattern=%d{DATE}: %m%n
31 |
--------------------------------------------------------------------------------
/simple-server-dynamic-sessions/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=*
9 | SenderSubID=*
10 | SenderLocationID=*
11 | TargetCompID=*
12 | TargetSubID=*
13 | TargetLocationID=*
14 | UseDataDictionary=Y
15 | DefaultMarketPrice=12.30
16 | FileLogPath=logs-server
17 | SocketAcceptPort=9876
18 |
19 | [session]
20 | BeginString=FIX.4.0
21 | AcceptorTemplate=Y
22 |
23 |
24 |
--------------------------------------------------------------------------------
/simple-server-listener/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-server-listener
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Server Listener
15 | QuickFixJ Spring Boot Starter Simple Server Listener
16 |
17 |
18 | UTF-8
19 | UTF-8
20 |
21 |
22 |
23 |
24 | io.allune
25 | quickfixj-spring-boot-starter
26 |
27 |
28 |
29 | io.allune
30 | quickfixj-spring-boot-actuator
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-web
36 |
37 |
38 |
39 | org.projectlombok
40 | lombok
41 |
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-starter-test
46 | test
47 |
48 |
49 |
50 |
51 | ${project.artifactId}
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-maven-plugin
56 |
57 |
58 |
59 | repackage
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/simple-server-listener/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/ApplicationListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.model.Create;
19 | import io.allune.quickfixj.spring.boot.starter.model.FromAdmin;
20 | import io.allune.quickfixj.spring.boot.starter.model.FromApp;
21 | import io.allune.quickfixj.spring.boot.starter.model.Logon;
22 | import io.allune.quickfixj.spring.boot.starter.model.Logout;
23 | import io.allune.quickfixj.spring.boot.starter.model.ToAdmin;
24 | import io.allune.quickfixj.spring.boot.starter.model.ToApp;
25 | import lombok.extern.slf4j.Slf4j;
26 | import org.springframework.context.event.EventListener;
27 | import org.springframework.stereotype.Component;
28 |
29 | @Slf4j
30 | @Component
31 | public class ApplicationListener {
32 |
33 | @EventListener
34 | public void handleFromAdmin1(FromAdmin fromAdmin) {
35 | log.info("fromAdmin: Message={}, SessionId={}", fromAdmin.getMessage(), fromAdmin.getSessionId());
36 | }
37 |
38 | @EventListener
39 | public void handleFromAdmin2(FromAdmin fromAdmin) {
40 | log.info("fromAdmin: Message={}, SessionId={}", fromAdmin.getMessage(), fromAdmin.getSessionId());
41 | }
42 |
43 | @EventListener
44 | public void handleFromApp(FromApp fromApp) {
45 | log.info("fromAdmin: Message={}, SessionId={}", fromApp.getMessage(), fromApp.getSessionId());
46 | }
47 |
48 | @EventListener
49 | public void handleCreate(Create create) {
50 | log.info("onCreate: SessionId={}", create.getSessionId());
51 | }
52 |
53 | @EventListener
54 | public void handleLogon(Logon logon) {
55 | log.info("onLogon: SessionId={}", logon.getSessionId());
56 | }
57 |
58 | @EventListener
59 | public void handleLogout(Logout logout) {
60 | log.info("onLogout: SessionId={}", logout.getSessionId());
61 | }
62 |
63 | @EventListener
64 | public void handleToAdmin(ToAdmin toAdmin) {
65 | log.info("toAdmin: SessionId={}", toAdmin.getSessionId());
66 | }
67 |
68 | @EventListener
69 | public void handleToApp(ToApp toApp) {
70 | log.info("toApp: SessionId={}", toApp.getSessionId());
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/simple-server-listener/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/SimpleServerListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
19 | import lombok.extern.slf4j.Slf4j;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 |
23 | @Slf4j
24 | @EnableQuickFixJServer
25 | @SpringBootApplication
26 | public class SimpleServerListener {
27 |
28 | public static void main(String[] args) {
29 | SpringApplication.run(SimpleServerListener.class, args);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/simple-server-listener/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | quickfixj:
2 | server:
3 | config: ${QUICKFIXJ_SERVER_CONFIG_FILE:classpath:quickfixj-server.cfg}
4 | jmx-enabled: true
5 |
6 | server:
7 | port: 8080
8 |
9 | management:
10 | endpoint:
11 | quickfixjserver:
12 | enabled: true
13 | endpoints:
14 | web:
15 | exposure:
16 | include: quickfixjserver
17 |
18 | logging:
19 | file:
20 | name: logs/server-listener.log
21 | pattern:
22 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
23 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
--------------------------------------------------------------------------------
/simple-server-listener/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 |
13 | [session]
14 | BeginString=FIX.4.0
15 | SocketAcceptPort=9876
16 |
17 | [session]
18 | BeginString=FIX.4.1
19 | SocketAcceptPort=9877
20 |
21 | [session]
22 | BeginString=FIX.4.2
23 | SocketAcceptPort=9878
24 |
25 | [session]
26 | BeginString=FIX.4.3
27 | SocketAcceptPort=9879
28 |
29 | [session]
30 | BeginString=FIX.4.4
31 | SocketAcceptPort=9880
32 |
33 | [session]
34 | BeginString=FIXT.1.1
35 | DefaultApplVerID=FIX.5.0
36 | SocketAcceptPort=9881
--------------------------------------------------------------------------------
/simple-server-sender/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | quickfixj-spring-boot-starter-examples
5 | io.allune
6 | 2.17.2-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | simple-server-sender
11 | QuickFixJ Spring Boot Starter Examples :: Simple Server Sender
12 | QuickFixJ Spring Boot Starter Simple Server Sender
13 |
14 |
15 |
16 | io.allune
17 | quickfixj-spring-boot-starter
18 |
19 |
20 | org.springframework.boot
21 | spring-boot-starter-web
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-test
26 | test
27 |
28 |
29 | io.rest-assured
30 | rest-assured
31 | test
32 |
33 |
34 | org.projectlombok
35 | lombok
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/simple-server-sender/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SenderController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.template.QuickFixJTemplate;
19 | import org.springframework.http.ResponseEntity;
20 | import org.springframework.web.bind.annotation.GetMapping;
21 | import org.springframework.web.bind.annotation.RequestMapping;
22 | import org.springframework.web.bind.annotation.RequestParam;
23 | import org.springframework.web.bind.annotation.ResponseStatus;
24 | import org.springframework.web.bind.annotation.RestController;
25 | import quickfix.Acceptor;
26 | import quickfix.Message;
27 | import quickfix.Session;
28 | import quickfix.SessionID;
29 | import quickfix.SessionNotFound;
30 | import quickfix.StringField;
31 | import quickfix.field.AvgPx;
32 | import quickfix.field.ClOrdID;
33 | import quickfix.field.CumQty;
34 | import quickfix.field.ExecID;
35 | import quickfix.field.ExecType;
36 | import quickfix.field.LeavesQty;
37 | import quickfix.field.OnBehalfOfCompID;
38 | import quickfix.field.OrdStatus;
39 | import quickfix.field.OrdType;
40 | import quickfix.field.OrderID;
41 | import quickfix.field.OrderQty;
42 | import quickfix.field.OrigClOrdID;
43 | import quickfix.field.Product;
44 | import quickfix.field.QuoteID;
45 | import quickfix.field.QuoteReqID;
46 | import quickfix.field.SettlDate;
47 | import quickfix.field.SettlType;
48 | import quickfix.field.Side;
49 | import quickfix.field.Spread;
50 | import quickfix.field.Symbol;
51 | import quickfix.field.Text;
52 | import quickfix.field.TransactTime;
53 | import quickfix.fix42.QuoteRequest;
54 | import quickfix.fix44.ExecutionReport;
55 |
56 | import java.util.HashMap;
57 | import java.util.Map;
58 | import java.util.UUID;
59 |
60 | import static java.util.UUID.randomUUID;
61 | import static org.springframework.http.HttpStatus.OK;
62 | import static quickfix.FixVersions.BEGINSTRING_FIX41;
63 | import static quickfix.FixVersions.BEGINSTRING_FIXT11;
64 |
65 | @RestController
66 | public class SenderController {
67 |
68 | private static final Map> messageMap = createMessageMap();
69 | private final QuickFixJTemplate quickFixJTemplate;
70 | private final Acceptor serverAcceptor;
71 |
72 | public SenderController(QuickFixJTemplate serverQuickFixJTemplate, Acceptor serverAcceptor) {
73 | this.quickFixJTemplate = serverQuickFixJTemplate;
74 | this.serverAcceptor = serverAcceptor;
75 | }
76 |
77 | private static HashMap> createMessageMap() {
78 | HashMap> stringMapHashMap = new HashMap<>();
79 | stringMapHashMap.put(BEGINSTRING_FIX41, initialiseFix41MessageMap());
80 | stringMapHashMap.put(BEGINSTRING_FIXT11, initialiseFix50MessageMap());
81 | return stringMapHashMap;
82 | }
83 |
84 | private static Map initialiseFix41MessageMap() {
85 | Map messageMap = new HashMap<>();
86 | messageMap.put("OrderCancelRequest", new quickfix.fix41.OrderCancelRequest(
87 | new OrigClOrdID("123"),
88 | new ClOrdID("321"),
89 | new Symbol("LNUX"),
90 | new Side(Side.BUY)));
91 | return messageMap;
92 | }
93 |
94 | private static Map initialiseFix50MessageMap() {
95 | Map messageMap = new HashMap<>();
96 | messageMap.put("Quote", new quickfix.fix50.Quote(new QuoteID("123")));
97 | return messageMap;
98 | }
99 |
100 | @RequestMapping("/send-message")
101 | @ResponseStatus(OK)
102 | public void sendMessage(@RequestParam String fixVersion, @RequestParam String messageType) {
103 |
104 | Map stringMessageMap = messageMap.get(fixVersion);
105 | Message message = stringMessageMap.get(messageType);
106 | message.setField(new StringField(Text.FIELD, "Text: " + randomUUID().toString()));
107 |
108 | SessionID sessionID = serverAcceptor.getSessions().stream()
109 | .filter(id -> id.getBeginString().equals(fixVersion))
110 | .findFirst()
111 | .orElseThrow(RuntimeException::new);
112 | quickFixJTemplate.send(message, sessionID);
113 | }
114 |
115 | @GetMapping(path = "/path1")
116 | public ResponseEntity> getPath1() throws SessionNotFound {
117 | QuoteRequest quoteRequest = createQuoteRequest(UUID.randomUUID());
118 | SessionID sessionID = new SessionID("FIX.4.2", "EXEC", "BANZAI");
119 | Session.sendToTarget(quoteRequest, sessionID);
120 |
121 | return ResponseEntity.ok("OK");
122 | }
123 |
124 | @GetMapping(path = "/path2")
125 | public ResponseEntity> getPath2() throws SessionNotFound {
126 | QuoteRequest quoteRequest = createQuoteRequest(UUID.randomUUID());
127 | SessionID sessionID = new SessionID("FIX.4.2", "EXEC", "BANZAI");
128 | Session.sendToTarget(quoteRequest, sessionID);
129 |
130 | return ResponseEntity.ok("OK");
131 |
132 | }
133 |
134 | @GetMapping(path = "/execution-report")
135 | public ResponseEntity> executionReport() throws SessionNotFound{
136 | ExecutionReport executionReport = new ExecutionReport(new OrderID("3-2-805331618T-0-0"), new ExecID("3-2-805331618T-0-0"), new ExecType(ExecType.TRADE),
137 | new OrdStatus(OrdStatus.FILLED), new Side(Side.BUY), new LeavesQty(0), new CumQty(1000000), new AvgPx(5.57765));
138 | SessionID sessionID = new SessionID("FIX.4.4", "EXEC", "BANZAI");
139 | OnBehalfOfCompID onBehalfOfCompId = new OnBehalfOfCompID("FX");
140 | executionReport.set(new TransactTime());
141 | executionReport.set(new SettlType(SettlType.REGULAR_FX_SPOT_SETTLEMENT));
142 | executionReport.set(new SettlDate("20201016"));
143 | executionReport.set(new OrderQty(1000000));
144 | executionReport.set(new Spread(0));
145 | executionReport.set(new OrdType(OrdType.MARKET));
146 | executionReport.set(new Product(Product.CURRENCY));
147 | // executionReport.set(new TradePublishIndicator(TradePublishIndicator.DO_NOT_PUBLISH_TRADE));
148 | executionReport.set(new ClOrdID("3-2-805331618T-0-0"));
149 | // executionReport.set(new OfferPx(5.57765));
150 | executionReport.set(new Symbol("USD/BRL"));
151 |
152 |
153 | Session.sendToTarget(executionReport, sessionID);
154 | return ResponseEntity.ok("OK");
155 | }
156 | // AllocationInstruction
157 |
158 | private QuoteRequest createQuoteRequest(UUID operationId) {
159 | return new QuoteRequest(new QuoteReqID(operationId.toString()));
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/simple-server-sender/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SimpleServerSender.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
19 | import org.springframework.boot.SpringApplication;
20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
21 | import org.springframework.context.annotation.Bean;
22 | import quickfix.Application;
23 | import quickfix.ApplicationAdapter;
24 | import quickfix.ConfigError;
25 | import quickfix.Initiator;
26 | import quickfix.LogFactory;
27 | import quickfix.MessageFactory;
28 | import quickfix.MessageStoreFactory;
29 | import quickfix.SessionSettings;
30 | import quickfix.ThreadedSocketInitiator;
31 |
32 | @EnableQuickFixJServer
33 | @SpringBootApplication
34 | public class SimpleServerSender {
35 |
36 | public static void main(String[] args) {
37 | SpringApplication.run(SimpleServerSender.class, args);
38 | }
39 |
40 | @Bean
41 | public Application clientApplication() {
42 | return new ApplicationAdapter();
43 | }
44 |
45 | @Bean
46 | public Initiator clientInitiator(
47 | quickfix.Application clientApplication,
48 | MessageStoreFactory clientMessageStoreFactory,
49 | SessionSettings clientSessionSettings,
50 | LogFactory clientLogFactory,
51 | MessageFactory clientMessageFactory
52 | ) throws ConfigError {
53 |
54 | return new ThreadedSocketInitiator(
55 | clientApplication,
56 | clientMessageStoreFactory,
57 | clientSessionSettings,
58 | clientLogFactory,
59 | clientMessageFactory
60 | );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/simple-server-sender/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | server:
7 | config: ${QUICKFIXJ_SERVER_CONFIG_FILE:classpath:quickfixj-server.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8080
12 |
13 | management:
14 | endpoint:
15 | quickfixjserver:
16 | enabled: true
17 | endpoints:
18 | web:
19 | exposure:
20 | include: quickfixjserver
21 |
22 | logging:
23 | file:
24 | name: logs/server-sender.log
25 | pattern:
26 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
27 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
28 |
--------------------------------------------------------------------------------
/simple-server-sender/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 | FileLogPath=logs-server
13 |
14 | [session]
15 | BeginString=FIX.4.0
16 | SocketAcceptPort=9876
17 |
18 | [session]
19 | BeginString=FIX.4.1
20 | SocketAcceptPort=9877
21 |
22 | [session]
23 | BeginString=FIX.4.2
24 | SocketAcceptPort=9878
25 |
26 | [session]
27 | BeginString=FIX.4.3
28 | SocketAcceptPort=9879
29 |
30 | [session]
31 | BeginString=FIX.4.4
32 | SocketAcceptPort=9880
33 |
34 | [session]
35 | BeginString=FIXT.1.1
36 | DefaultApplVerID=FIX.5.0
37 | SocketAcceptPort=9881
--------------------------------------------------------------------------------
/simple-server-sender/src/main/resources/sender.http:
--------------------------------------------------------------------------------
1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection) or
2 | # paste cURL into the file and request will be converted to HTTP Request format.
3 | #
4 | # Following HTTP Request Live Templates are available:
5 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters;
6 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
7 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
8 |
9 | ### Send FIX.4.1 - OrderCancelRequest
10 | GET http://localhost:8089/send-message?fixVersion=FIX.4.1&messageType=OrderCancelRequest
11 |
12 | ### Send FIXT1.1 - Quote
13 | GET http://localhost:8089/send-message?fixVersion=FIXT.1.1&messageType=Quote
14 |
15 | ###
--------------------------------------------------------------------------------
/simple-server-sender/src/test/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SenderControllerGetPath1IntegrationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 |
19 | import org.junit.jupiter.api.Test;
20 | import org.springframework.boot.test.context.SpringBootTest;
21 | import org.springframework.test.annotation.DirtiesContext;
22 | import org.springframework.test.context.ContextConfiguration;
23 |
24 | import static io.restassured.RestAssured.given;
25 |
26 | @ContextConfiguration(classes = SimpleServerSender.class)
27 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
28 | @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
29 | public class SenderControllerGetPath1IntegrationTest {
30 |
31 | @Test
32 | public void canGetPath1() {
33 | // @formatter:off
34 | given()
35 | .contentType("application/json")
36 | .when()
37 | .get("/path1")
38 | .then()
39 | .assertThat()
40 | .statusCode(200);
41 | // @formatter:on
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/simple-server-sender/src/test/java/io/allune/quickfixj/spring/boot/starter/examples/sender/SenderControllerGetPath2IntegrationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.sender;
17 |
18 | import org.junit.jupiter.api.Test;
19 | import org.springframework.boot.test.context.SpringBootTest;
20 | import org.springframework.test.annotation.DirtiesContext;
21 | import org.springframework.test.context.ContextConfiguration;
22 |
23 | import static io.restassured.RestAssured.given;
24 |
25 | @ContextConfiguration(classes = SimpleServerSender.class)
26 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
27 | @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
28 | public class SenderControllerGetPath2IntegrationTest {
29 |
30 | @Test
31 | public void canGetPath2() {
32 | // @formatter:off
33 | given()
34 | .contentType("application/json")
35 | .when()
36 | .get("/path2")
37 | .then()
38 | .assertThat()
39 | .statusCode(200);
40 | // @formatter:on
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/simple-server-spring-3/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-server-spring-3
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Server Spring 3
15 | QuickFixJ Spring Boot Starter Server Spring 3
16 |
17 |
18 | UTF-8
19 | UTF-8
20 | 17
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-dependencies
30 | 3.2.2
31 | pom
32 | import
33 |
34 |
35 |
36 |
37 |
38 |
39 | io.allune
40 | quickfixj-spring-boot-starter
41 |
42 |
43 |
44 | io.allune
45 | quickfixj-spring-boot-actuator
46 |
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-starter-web
51 |
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-starter-test
56 | test
57 |
58 |
59 |
60 |
61 | ${project.artifactId}
62 |
63 |
64 | org.springframework.boot
65 | spring-boot-maven-plugin
66 |
67 |
68 |
69 | repackage
70 |
71 |
72 |
73 |
74 |
75 | org.apache.maven.plugins
76 | maven-compiler-plugin
77 | 3.3
78 |
79 | 17
80 | 17
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/simple-server-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/ServerApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.Message;
22 | import quickfix.SessionID;
23 |
24 | public class ServerApplicationAdapter implements Application {
25 |
26 | private static final Logger log = LoggerFactory.getLogger(ServerApplicationAdapter.class);
27 |
28 | @Override
29 | public void fromAdmin(Message message, SessionID sessionId) {
30 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
31 | }
32 |
33 | @Override
34 | public void fromApp(Message message, SessionID sessionId) {
35 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
36 | }
37 |
38 | @Override
39 | public void onCreate(SessionID sessionId) {
40 | log.info("onCreate: SessionId={}", sessionId);
41 | }
42 |
43 | @Override
44 | public void onLogon(SessionID sessionId) {
45 | log.info("onLogon: SessionId={}", sessionId);
46 | }
47 |
48 | @Override
49 | public void onLogout(SessionID sessionId) {
50 | log.info("onLogout: SessionId={}", sessionId);
51 | }
52 |
53 | @Override
54 | public void toAdmin(Message message, SessionID sessionId) {
55 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
56 | }
57 |
58 | @Override
59 | public void toApp(Message message, SessionID sessionId) {
60 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/simple-server-spring-3/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/SimpleServerSpring3.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
19 | import org.springframework.boot.SpringApplication;
20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
21 | import org.springframework.context.annotation.Bean;
22 | import quickfix.Acceptor;
23 | import quickfix.Application;
24 | import quickfix.ConfigError;
25 | import quickfix.FileLogFactory;
26 | import quickfix.LogFactory;
27 | import quickfix.MessageFactory;
28 | import quickfix.MessageStoreFactory;
29 | import quickfix.SessionSettings;
30 | import quickfix.ThreadedSocketAcceptor;
31 |
32 | @EnableQuickFixJServer
33 | @SpringBootApplication
34 | public class SimpleServerSpring3 {
35 |
36 | public static void main(String[] args) {
37 | SpringApplication.run(SimpleServerSpring3.class, args);
38 | }
39 |
40 | @Bean
41 | public Application serverApplication() {
42 | return new ServerApplicationAdapter();
43 | }
44 |
45 | @Bean
46 | public Acceptor serverAcceptor(quickfix.Application serverApplication, MessageStoreFactory serverMessageStoreFactory,
47 | SessionSettings serverSessionSettings, LogFactory serverLogFactory,
48 | MessageFactory serverMessageFactory) throws ConfigError {
49 |
50 | return new ThreadedSocketAcceptor(serverApplication, serverMessageStoreFactory, serverSessionSettings,
51 | serverLogFactory, serverMessageFactory);
52 | }
53 |
54 | @Bean
55 | public LogFactory serverLogFactory(SessionSettings serverSessionSettings) {
56 | return new FileLogFactory(serverSessionSettings);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/simple-server-spring-3/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | server:
7 | config: ${QUICKFIXJ_SERVER_CONFIG_FILE:classpath:quickfixj-server.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8080
12 |
13 | management:
14 | endpoint:
15 | quickfixjserver:
16 | enabled: true
17 | endpoints:
18 | web:
19 | exposure:
20 | include: quickfixjserver
21 |
22 | logging:
23 | file:
24 | name: logs/server.log
25 | pattern:
26 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
27 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
28 |
--------------------------------------------------------------------------------
/simple-server-spring-3/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Loggers
3 | #
4 | # Catch-all
5 | log4j.rootLogger=INFO, ROOT
6 | # Repeat for each session...
7 | log4j.logger.EXEC.BANZAI=INFO, EXEC_BANZAI
8 | log4j.additivity.EXEC.BANZAI=false
9 | log4j.logger.EXEC.BANZAI.events=INFO, EXEC_BANZAI_EV
10 | log4j.additivity.EXEC.BANZAI.events=false
11 | #
12 | # Appenders
13 | #
14 | log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
15 | log4j.appender.ROOT.File=log/QuickFixJ-root.log
16 | log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
17 | log4j.appender.ROOT.layout.ConversionPattern=%d{DATE} %p [%t] %c - %m %n
18 | log4j.appender.ROOT.MaxFileSize=500KB
19 | log4j.appender.ROOT.MaxBackupIndex=3
20 | # Repeat for each session...
21 | log4j.appender.EXEC_BANZAI=org.apache.log4j.DailyRollingFileAppender
22 | log4j.appender.EXEC_BANZAI.DatePattern='.'yyyy-MM-dd
23 | log4j.appender.EXEC_BANZAI.File=log/EXEC-BANZAI.messages.log
24 | log4j.appender.EXEC_BANZAI.layout=org.apache.log4j.PatternLayout
25 | log4j.appender.EXEC_BANZAI.layout.ConversionPattern=%m%n
26 | log4j.appender.EXEC_BANZAI_EV=org.apache.log4j.DailyRollingFileAppender
27 | log4j.appender.EXEC_BANZAI_EV.DatePattern='.'yyyy-MM-dd
28 | log4j.appender.EXEC_BANZAI_EV.File=log/EXEC-BANZAI.events.log
29 | log4j.appender.EXEC_BANZAI_EV.layout=org.apache.log4j.PatternLayout
30 | log4j.appender.EXEC_BANZAI_EV.layout.ConversionPattern=%d{DATE}: %m%n
31 |
--------------------------------------------------------------------------------
/simple-server-spring-3/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 | FileLogPath=logs-server
13 |
14 | [session]
15 | BeginString=FIX.4.0
16 | SocketAcceptPort=9876
17 |
18 | [session]
19 | BeginString=FIX.4.1
20 | SocketAcceptPort=9877
21 |
22 | [session]
23 | BeginString=FIX.4.2
24 | SocketAcceptPort=9878
25 |
26 | [session]
27 | BeginString=FIX.4.3
28 | SocketAcceptPort=9879
29 |
30 | [session]
31 | BeginString=FIX.4.4
32 | SocketAcceptPort=9880
33 |
34 | [session]
35 | BeginString=FIXT.1.1
36 | DefaultApplVerID=FIX.5.0
37 | SocketAcceptPort=9881
38 |
--------------------------------------------------------------------------------
/simple-server-with-database/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-server-with-database
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Server with Database
15 | QuickFixJ Spring Boot Starter Server with Database Example
16 |
17 |
18 | UTF-8
19 | UTF-8
20 |
21 |
22 |
23 |
24 | docker
25 |
26 |
27 | mysql
28 | mysql-connector-java
29 |
30 |
31 |
32 |
33 |
34 | !docker
35 |
36 | true
37 |
38 |
39 |
40 | org.hsqldb
41 | hsqldb
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | io.allune
50 | quickfixj-spring-boot-starter
51 |
52 |
53 | proxool
54 | proxool
55 |
56 |
57 |
58 |
59 |
60 | io.allune
61 | quickfixj-spring-boot-actuator
62 |
63 |
64 | proxool
65 | proxool
66 |
67 |
68 |
69 |
70 |
71 | org.springframework.boot
72 | spring-boot-starter-web
73 |
74 |
75 |
76 | org.springframework.boot
77 | spring-boot-starter-jdbc
78 |
79 |
80 |
81 | org.apache.commons
82 | commons-dbcp2
83 |
84 |
85 |
86 | org.projectlombok
87 | lombok
88 |
89 |
90 |
91 | org.springframework.boot
92 | spring-boot-starter-test
93 | test
94 |
95 |
96 |
97 |
98 | ${project.artifactId}
99 |
100 |
101 | org.springframework.boot
102 | spring-boot-maven-plugin
103 |
104 |
105 |
106 | repackage
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/DbConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import org.apache.commons.dbcp2.BasicDataSource;
19 | import org.springframework.beans.factory.annotation.Value;
20 | import org.springframework.context.annotation.Bean;
21 | import org.springframework.context.annotation.Configuration;
22 | import org.springframework.context.annotation.Primary;
23 | import org.springframework.context.annotation.Profile;
24 | import org.springframework.core.io.Resource;
25 | import org.springframework.jdbc.datasource.init.DataSourceInitializer;
26 | import org.springframework.jdbc.datasource.init.DatabasePopulator;
27 | import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
28 |
29 | import javax.sql.DataSource;
30 |
31 | @Profile("!docker")
32 | @Configuration
33 | public class DbConfiguration {
34 |
35 | @Value("classpath:hsqldb/data.sql")
36 | private Resource dataScript;
37 |
38 | @Bean
39 | @Primary
40 | public DataSource dataSource() {
41 | BasicDataSource datasource = new BasicDataSource();
42 | datasource.setDriverClassName("org.hsqldb.jdbcDriver");
43 | datasource.setUrl("jdbc:hsqldb:file:./db/data;hsqldb.lock_file=false");
44 | datasource.setUsername("sa");
45 | datasource.setPassword("");
46 | return datasource;
47 | }
48 |
49 | @Bean
50 | public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
51 | final DataSourceInitializer initializer = new DataSourceInitializer();
52 | initializer.setDataSource(dataSource);
53 | initializer.setDatabasePopulator(databasePopulator());
54 | return initializer;
55 | }
56 |
57 | private DatabasePopulator databasePopulator() {
58 | final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
59 | populator.addScript(dataScript);
60 | return populator;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/ServerApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.Message;
22 | import quickfix.SessionID;
23 |
24 | public class ServerApplicationAdapter implements Application {
25 |
26 | private static final Logger log = LoggerFactory.getLogger(ServerApplicationAdapter.class);
27 |
28 | @Override
29 | public void fromAdmin(Message message, SessionID sessionId) {
30 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
31 | }
32 |
33 | @Override
34 | public void fromApp(Message message, SessionID sessionId) {
35 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
36 | }
37 |
38 | @Override
39 | public void onCreate(SessionID sessionId) {
40 | log.info("onCreate: SessionId={}", sessionId);
41 | }
42 |
43 | @Override
44 | public void onLogon(SessionID sessionId) {
45 | log.info("onLogon: SessionId={}", sessionId);
46 | }
47 |
48 | @Override
49 | public void onLogout(SessionID sessionId) {
50 | log.info("onLogout: SessionId={}", sessionId);
51 | }
52 |
53 | @Override
54 | public void toAdmin(Message message, SessionID sessionId) {
55 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
56 | }
57 |
58 | @Override
59 | public void toApp(Message message, SessionID sessionId) {
60 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
61 | }
62 | }
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/SimpleServerWithDatabase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
19 | import lombok.extern.slf4j.Slf4j;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 | import org.springframework.context.annotation.Bean;
23 | import quickfix.Acceptor;
24 | import quickfix.Application;
25 | import quickfix.ConfigError;
26 | import quickfix.JdbcLogFactory;
27 | import quickfix.JdbcStoreFactory;
28 | import quickfix.LogFactory;
29 | import quickfix.MessageFactory;
30 | import quickfix.MessageStoreFactory;
31 | import quickfix.SessionSettings;
32 | import quickfix.ThreadedSocketAcceptor;
33 |
34 | import javax.sql.DataSource;
35 |
36 | @Slf4j
37 | @EnableQuickFixJServer
38 | @SpringBootApplication
39 | public class SimpleServerWithDatabase {
40 |
41 | public static void main(String[] args) {
42 | SpringApplication.run(SimpleServerWithDatabase.class, args);
43 | }
44 |
45 | @Bean
46 | public Application serverApplication() {
47 | return new ServerApplicationAdapter();
48 | }
49 |
50 | @Bean
51 | public Acceptor serverAcceptor(quickfix.Application serverApplication, MessageStoreFactory serverMessageStoreFactory,
52 | SessionSettings serverSessionSettings, LogFactory serverLogFactory,
53 | MessageFactory serverMessageFactory) throws ConfigError {
54 |
55 | return new ThreadedSocketAcceptor(serverApplication, serverMessageStoreFactory, serverSessionSettings,
56 | serverLogFactory, serverMessageFactory);
57 | }
58 |
59 | @Bean
60 | public MessageStoreFactory serverMessageStoreFactory(SessionSettings serverSessionSettings, DataSource dataSource) {
61 | JdbcStoreFactory jdbcStoreFactory = new JdbcStoreFactory(serverSessionSettings);
62 | jdbcStoreFactory.setDataSource(dataSource);
63 | return jdbcStoreFactory;
64 | }
65 |
66 | @Bean
67 | public LogFactory serverLogFactory(SessionSettings serverSessionSettings, DataSource dataSource) {
68 | JdbcLogFactory jdbcLogFactory = new JdbcLogFactory(serverSessionSettings);
69 | jdbcLogFactory.setDataSource(dataSource);
70 | return jdbcLogFactory;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | server:
7 | config: ${QUICKFIXJ_SERVER_CONFIG_FILE:classpath:quickfixj-server.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8080
12 |
13 | management:
14 | endpoint:
15 | quickfixjserver:
16 | enabled: true
17 | endpoints:
18 | web:
19 | exposure:
20 | include: quickfixjserver
21 |
22 | logging:
23 | file:
24 | name: logs/server-with-database.log
25 | pattern:
26 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
27 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
28 |
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/resources/hsqldb/data.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE messages IF EXISTS;
2 | DROP TABLE messages_log IF EXISTS;
3 | DROP TABLE event_log IF EXISTS;
4 | DROP TABLE sessions IF EXISTS;
5 |
6 | CREATE TABLE messages
7 | (
8 | beginstring CHAR(8) NOT NULL,
9 | sendercompid VARCHAR(64) NOT NULL,
10 | sendersubid VARCHAR(64) NOT NULL,
11 | senderlocid VARCHAR(64) NOT NULL,
12 | targetcompid VARCHAR(64) NOT NULL,
13 | targetsubid VARCHAR(64) NOT NULL,
14 | targetlocid VARCHAR(64) NOT NULL,
15 | session_qualifier VARCHAR(64) NOT NULL,
16 | msgseqnum INT NOT NULL,
17 | message VARCHAR(2048) NOT NULL,
18 | PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
19 | targetcompid, targetsubid, targetlocid, session_qualifier,
20 | msgseqnum)
21 | );
22 |
23 | CREATE TABLE messages_log
24 | (
25 | id INT IDENTITY PRIMARY KEY,
26 | time DATETIME NOT NULL,
27 | beginstring CHAR(8) NOT NULL,
28 | sendercompid VARCHAR(64) NOT NULL,
29 | sendersubid VARCHAR(64) NOT NULL,
30 | senderlocid VARCHAR(64) NOT NULL,
31 | targetcompid VARCHAR(64) NOT NULL,
32 | targetsubid VARCHAR(64) NOT NULL,
33 | targetlocid VARCHAR(64) NOT NULL,
34 | session_qualifier VARCHAR(64) NOT NULL,
35 | text VARCHAR(2048) NOT NULL
36 | );
37 |
38 | CREATE TABLE event_log
39 | (
40 | id INT IDENTITY PRIMARY KEY,
41 | time DATETIME NOT NULL,
42 | beginstring CHAR(8) NOT NULL,
43 | sendercompid VARCHAR(64) NOT NULL,
44 | sendersubid VARCHAR(64) NOT NULL,
45 | senderlocid VARCHAR(64) NOT NULL,
46 | targetcompid VARCHAR(64) NOT NULL,
47 | targetsubid VARCHAR(64) NOT NULL,
48 | targetlocid VARCHAR(64) NOT NULL,
49 | session_qualifier VARCHAR(64),
50 | text VARCHAR(2048) NOT NULL
51 | );
52 |
53 | CREATE TABLE sessions
54 | (
55 | beginstring CHAR(8) NOT NULL,
56 | sendercompid VARCHAR(64) NOT NULL,
57 | sendersubid VARCHAR(64) NOT NULL,
58 | senderlocid VARCHAR(64) NOT NULL,
59 | targetcompid VARCHAR(64) NOT NULL,
60 | targetsubid VARCHAR(64) NOT NULL,
61 | targetlocid VARCHAR(64) NOT NULL,
62 | session_qualifier VARCHAR(64) NOT NULL,
63 | creation_time DATETIME NOT NULL,
64 | incoming_seqnum INT NOT NULL,
65 | outgoing_seqnum INT NOT NULL,
66 | PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
67 | targetcompid, targetsubid, targetlocid, session_qualifier)
68 | );
69 |
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Loggers
3 | #
4 | # Catch-all
5 | log4j.rootLogger=INFO, ROOT
6 | # Repeat for each session...
7 | log4j.logger.EXEC.BANZAI=INFO, EXEC_BANZAI
8 | log4j.additivity.EXEC.BANZAI=false
9 | log4j.logger.EXEC.BANZAI.events=INFO, EXEC_BANZAI_EV
10 | log4j.additivity.EXEC.BANZAI.events=false
11 | #
12 | # Appenders
13 | #
14 | log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
15 | log4j.appender.ROOT.File=log/QuickFixJ-root.log
16 | log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
17 | log4j.appender.ROOT.layout.ConversionPattern=%d{DATE} %p [%t] %c - %m %n
18 | log4j.appender.ROOT.MaxFileSize=500KB
19 | log4j.appender.ROOT.MaxBackupIndex=3
20 | # Repeat for each session...
21 | log4j.appender.EXEC_BANZAI=org.apache.log4j.DailyRollingFileAppender
22 | log4j.appender.EXEC_BANZAI.DatePattern='.'yyyy-MM-dd
23 | log4j.appender.EXEC_BANZAI.File=log/EXEC-BANZAI.messages.log
24 | log4j.appender.EXEC_BANZAI.layout=org.apache.log4j.PatternLayout
25 | log4j.appender.EXEC_BANZAI.layout.ConversionPattern=%m%n
26 | log4j.appender.EXEC_BANZAI_EV=org.apache.log4j.DailyRollingFileAppender
27 | log4j.appender.EXEC_BANZAI_EV.DatePattern='.'yyyy-MM-dd
28 | log4j.appender.EXEC_BANZAI_EV.File=log/EXEC-BANZAI.events.log
29 | log4j.appender.EXEC_BANZAI_EV.layout=org.apache.log4j.PatternLayout
30 | log4j.appender.EXEC_BANZAI_EV.layout.ConversionPattern=%d{DATE}: %m%n
31 |
--------------------------------------------------------------------------------
/simple-server-with-database/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | ConnectionType=acceptor
3 | StartTime=00:00:00
4 | EndTime=00:00:00
5 | HeartBtInt=30
6 | ValidOrderTypes=1,2,F
7 | SenderCompID=EXEC
8 | TargetCompID=BANZAI
9 | UseDataDictionary=Y
10 | DefaultMarketPrice=12.30
11 |
12 | JdbcDriver=org.hsqldb.jdbc.JDBCDriver
13 | JdbcURL=jdbc:hsqldb:file:./db/data;hsqldb.lock_file=false
14 | JdbcUser=sa
15 | JdbcPassword=
16 | JdbcLogHeartBeats=N
17 | JdbcStoreMessagesTableName=messages
18 | JdbcStoreSessionsTableName=sessions
19 | JdbcLogEventTable=event_log
20 | JdbcLogIncomingTable=messages_log
21 | JdbcLogOutgoingTable=messages_log
22 |
23 | [session]
24 | BeginString=FIX.4.0
25 | SocketAcceptPort=9876
26 |
27 | [session]
28 | BeginString=FIX.4.1
29 | SocketAcceptPort=9877
30 |
31 | [session]
32 | BeginString=FIX.4.2
33 | SocketAcceptPort=9878
34 |
35 | [session]
36 | BeginString=FIX.4.3
37 | SocketAcceptPort=9879
38 |
39 | [session]
40 | BeginString=FIX.4.4
41 | SocketAcceptPort=9880
42 |
43 | [session]
44 | BeginString=FIXT.1.1
45 | DefaultApplVerID=FIX.5.0
46 | SocketAcceptPort=9881
47 |
48 |
49 |
--------------------------------------------------------------------------------
/simple-server/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | io.allune
7 | quickfixj-spring-boot-starter-examples
8 | 2.17.2-SNAPSHOT
9 |
10 |
11 | simple-server
12 | jar
13 |
14 | QuickFixJ Spring Boot Starter Examples :: Simple Server
15 | QuickFixJ Spring Boot Starter Server Example
16 |
17 |
18 | UTF-8
19 | UTF-8
20 |
21 |
22 |
23 |
24 | io.allune
25 | quickfixj-spring-boot-starter
26 |
27 |
28 |
29 | io.allune
30 | quickfixj-spring-boot-actuator
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-web
36 |
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-starter-test
41 | test
42 |
43 |
44 |
45 |
46 | ${project.artifactId}
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-maven-plugin
51 |
52 |
53 |
54 | repackage
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/simple-server/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/ServerApplicationAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import org.slf4j.Logger;
19 | import org.slf4j.LoggerFactory;
20 | import quickfix.Application;
21 | import quickfix.Message;
22 | import quickfix.SessionID;
23 |
24 | public class ServerApplicationAdapter implements Application {
25 |
26 | private static final Logger log = LoggerFactory.getLogger(ServerApplicationAdapter.class);
27 |
28 | @Override
29 | public void fromAdmin(Message message, SessionID sessionId) {
30 | log.info("fromAdmin: Message={}, SessionId={}", message, sessionId);
31 | }
32 |
33 | @Override
34 | public void fromApp(Message message, SessionID sessionId) {
35 | log.info("fromApp: Message={}, SessionId={}", message, sessionId);
36 | }
37 |
38 | @Override
39 | public void onCreate(SessionID sessionId) {
40 | log.info("onCreate: SessionId={}", sessionId);
41 | }
42 |
43 | @Override
44 | public void onLogon(SessionID sessionId) {
45 | log.info("onLogon: SessionId={}", sessionId);
46 | }
47 |
48 | @Override
49 | public void onLogout(SessionID sessionId) {
50 | log.info("onLogout: SessionId={}", sessionId);
51 | }
52 |
53 | @Override
54 | public void toAdmin(Message message, SessionID sessionId) {
55 | log.info("toAdmin: Message={}, SessionId={}", message, sessionId);
56 | }
57 |
58 | @Override
59 | public void toApp(Message message, SessionID sessionId) {
60 | log.info("toApp: Message={}, SessionId={}", message, sessionId);
61 | }
62 | }
--------------------------------------------------------------------------------
/simple-server/src/main/java/io/allune/quickfixj/spring/boot/starter/examples/server/SimpleServer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017-2023 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package io.allune.quickfixj.spring.boot.starter.examples.server;
17 |
18 | import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJServer;
19 | import org.springframework.boot.SpringApplication;
20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
21 | import org.springframework.context.annotation.Bean;
22 | import quickfix.Acceptor;
23 | import quickfix.Application;
24 | import quickfix.ConfigError;
25 | import quickfix.FileLogFactory;
26 | import quickfix.LogFactory;
27 | import quickfix.MessageFactory;
28 | import quickfix.MessageStoreFactory;
29 | import quickfix.SessionSettings;
30 | import quickfix.ThreadedSocketAcceptor;
31 |
32 | @EnableQuickFixJServer
33 | @SpringBootApplication
34 | public class SimpleServer {
35 |
36 | public static void main(String[] args) {
37 | SpringApplication.run(SimpleServer.class, args);
38 | }
39 |
40 | @Bean
41 | public Application serverApplication() {
42 | return new ServerApplicationAdapter();
43 | }
44 |
45 | @Bean
46 | public Acceptor serverAcceptor(quickfix.Application serverApplication, MessageStoreFactory serverMessageStoreFactory,
47 | SessionSettings serverSessionSettings, LogFactory serverLogFactory,
48 | MessageFactory serverMessageFactory) throws ConfigError {
49 |
50 | return new ThreadedSocketAcceptor(serverApplication, serverMessageStoreFactory, serverSessionSettings,
51 | serverLogFactory, serverMessageFactory);
52 | }
53 |
54 | @Bean
55 | public LogFactory serverLogFactory(SessionSettings serverSessionSettings) {
56 | return new FileLogFactory(serverSessionSettings);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/simple-server/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | main:
3 | allow-bean-definition-overriding: true
4 |
5 | quickfixj:
6 | server:
7 | config: ${QUICKFIXJ_SERVER_CONFIG_FILE:classpath:quickfixj-server.cfg}
8 | jmx-enabled: true
9 |
10 | server:
11 | port: 8080
12 |
13 | management:
14 | endpoint:
15 | health:
16 | show-details: always
17 | quickfixjserver:
18 | enabled: true
19 | health:
20 | quickfixjserver:
21 | enabled: true
22 | endpoints:
23 | web:
24 | exposure:
25 | include: quickfixjserver,health
26 |
27 | logging:
28 | file:
29 | name: logs/server.log
30 | pattern:
31 | file: "%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:%5p} ${PID: } --- [%t] %-40.40logger{39} : %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
32 | console: "${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID: }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %replace(%msg){'(\u0001)','|'}%n${LOG_EXCEPTION_CONVERSION_WORD:%rEx{5}}}"
33 |
--------------------------------------------------------------------------------
/simple-server/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Loggers
3 | #
4 | # Catch-all
5 | log4j.rootLogger=INFO, ROOT
6 | # Repeat for each session...
7 | log4j.logger.EXEC.BANZAI=INFO, EXEC_BANZAI
8 | log4j.additivity.EXEC.BANZAI=false
9 | log4j.logger.EXEC.BANZAI.events=INFO, EXEC_BANZAI_EV
10 | log4j.additivity.EXEC.BANZAI.events=false
11 | #
12 | # Appenders
13 | #
14 | log4j.appender.ROOT=org.apache.log4j.RollingFileAppender
15 | log4j.appender.ROOT.File=log/QuickFixJ-root.log
16 | log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
17 | log4j.appender.ROOT.layout.ConversionPattern=%d{DATE} %p [%t] %c - %m %n
18 | log4j.appender.ROOT.MaxFileSize=500KB
19 | log4j.appender.ROOT.MaxBackupIndex=3
20 | # Repeat for each session...
21 | log4j.appender.EXEC_BANZAI=org.apache.log4j.DailyRollingFileAppender
22 | log4j.appender.EXEC_BANZAI.DatePattern='.'yyyy-MM-dd
23 | log4j.appender.EXEC_BANZAI.File=log/EXEC-BANZAI.messages.log
24 | log4j.appender.EXEC_BANZAI.layout=org.apache.log4j.PatternLayout
25 | log4j.appender.EXEC_BANZAI.layout.ConversionPattern=%m%n
26 | log4j.appender.EXEC_BANZAI_EV=org.apache.log4j.DailyRollingFileAppender
27 | log4j.appender.EXEC_BANZAI_EV.DatePattern='.'yyyy-MM-dd
28 | log4j.appender.EXEC_BANZAI_EV.File=log/EXEC-BANZAI.events.log
29 | log4j.appender.EXEC_BANZAI_EV.layout=org.apache.log4j.PatternLayout
30 | log4j.appender.EXEC_BANZAI_EV.layout.ConversionPattern=%d{DATE}: %m%n
31 |
--------------------------------------------------------------------------------
/simple-server/src/main/resources/quickfixj-server.cfg:
--------------------------------------------------------------------------------
1 | [default]
2 | FileStorePath=target/data/executor
3 | ConnectionType=acceptor
4 | StartTime=00:00:00
5 | EndTime=00:00:00
6 | HeartBtInt=30
7 | ValidOrderTypes=1,2,F
8 | SenderCompID=EXEC
9 | TargetCompID=BANZAI
10 | UseDataDictionary=Y
11 | DefaultMarketPrice=12.30
12 | FileLogPath=logs-server
13 |
14 | [session]
15 | BeginString=FIX.4.0
16 | SocketAcceptPort=9876
17 |
18 | [session]
19 | BeginString=FIX.4.1
20 | SocketAcceptPort=9877
21 |
22 | [session]
23 | BeginString=FIX.4.2
24 | SocketAcceptPort=9878
25 |
26 | [session]
27 | BeginString=FIX.4.3
28 | SocketAcceptPort=9879
29 |
30 | [session]
31 | BeginString=FIX.4.4
32 | SocketAcceptPort=9880
33 |
34 | [session]
35 | BeginString=FIXT.1.1
36 | DefaultApplVerID=FIX.5.0
37 | SocketAcceptPort=9881
38 |
--------------------------------------------------------------------------------