-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an example of using the artifact build using legacy quickfixj c…
…ode generator
- Loading branch information
1 parent
3dc0a0f
commit 50f2f3c
Showing
15 changed files
with
590 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.quickfixj.custom.examples</groupId> | ||
<artifactId>custom-applications-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>using-legacy-codegen-client</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.allune</groupId> | ||
<artifactId>quickfixj-spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.allune</groupId> | ||
<artifactId>quickfixj-spring-boot-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.quickfixj</groupId> | ||
<artifactId>quickfixj-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.quickfixj</groupId> | ||
<artifactId>quickfixj-messages-fixt11</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.quickfixj.custom.examples</groupId> | ||
<artifactId>legacy-codegen-application-messages</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
11 changes: 11 additions & 0 deletions
11
...n-client/src/main/java/org/quickfixj/examples/legacy/custom/client/ClientApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.quickfixj.examples.legacy.custom.client; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class ClientApplication { | ||
public static void main(String[] args) throws InterruptedException { | ||
SpringApplication.run(ClientApplication.class, args); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...t/src/main/java/org/quickfixj/examples/legacy/custom/client/ClientApplicationAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.quickfixj.examples.legacy.custom.client; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import quickfix.*; | ||
import quickfix.field.*; | ||
import quickfix.fix50sp2.MessageCracker; | ||
import quickfix.fix50sp2.NewOrderSingle; | ||
import quickfix.fix50sp2.component.Instrument; | ||
import quickfix.fix50sp2.component.OrderQtyData; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
public class ClientApplicationAdapter implements Application { | ||
|
||
private final MessageCracker messageCracker; | ||
private final Logger log = LoggerFactory.getLogger(ClientApplicationAdapter.class); | ||
|
||
public ClientApplicationAdapter(MessageCracker messageCracker) { | ||
this.messageCracker = messageCracker; | ||
} | ||
|
||
@Override | ||
public void onLogon(SessionID sessionID) { | ||
log.info("logged on [{}] - [{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID()); | ||
try { | ||
Session.sendToTarget(newOrderSingle(),sessionID); | ||
} catch (SessionNotFound e) { | ||
log.error("SessionNot Found", e); | ||
} | ||
} | ||
|
||
@Override | ||
public void onLogout(SessionID sessionID) { | ||
log.info("logged out [{}] - [{}]", sessionID.getSenderCompID(), sessionID.getTargetCompID()); | ||
} | ||
|
||
@Override | ||
public void fromAdmin(Message message, SessionID sessionId) { | ||
log.info("fromAdmin: Message={}, SessionId={}", message, sessionId); | ||
} | ||
|
||
@Override | ||
public void onCreate(SessionID sessionId) { | ||
log.info("onCreate: SessionId={}", sessionId); | ||
} | ||
|
||
@Override | ||
public void toAdmin(Message message, SessionID sessionId) { | ||
log.info("toAdmin: Message={}, SessionId={}", message, sessionId); | ||
} | ||
|
||
@Override | ||
public void toApp(Message message, SessionID sessionId) { | ||
log.info("toApp: Message={}, SessionId={}", message, sessionId); | ||
} | ||
|
||
@Override | ||
public void fromApp(Message message, SessionID sessionID) | ||
throws FieldNotFound, IncorrectTagValue, UnsupportedMessageType { | ||
this.messageCracker.crack(message, sessionID); | ||
} | ||
|
||
private static NewOrderSingle newOrderSingle() { | ||
NewOrderSingle newOrderSingle = new NewOrderSingle(); | ||
newOrderSingle.set(new ClOrdID(UUID.randomUUID().toString())); | ||
newOrderSingle.set(new OrdType(OrdType.LIMIT)); | ||
newOrderSingle.set(new Price(99.09d)); | ||
newOrderSingle.set(new Side(Side.BUY)); | ||
newOrderSingle.set(new TransactTime(LocalDateTime.now())); | ||
Instrument instrument = new Instrument(); | ||
instrument.set(new Symbol("EX.AMPLE")); | ||
instrument.set(new SecurityIDSource(SecurityIDSource.EXAMPLE_CUSTOM_SECURITY_ID_SOURCE)); | ||
instrument.set(new SecurityID("202491685")); | ||
newOrderSingle.set(instrument); | ||
OrderQtyData orderQtyData = new OrderQtyData(); | ||
orderQtyData.set(new OrderQty(1.0d)); | ||
newOrderSingle.set(orderQtyData); | ||
return newOrderSingle; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...main/java/org/quickfixj/examples/legacy/custom/client/ClientApplicationConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.quickfixj.examples.legacy.custom.client; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import quickfix.*; | ||
import quickfix.fix50sp2.MessageCracker; | ||
|
||
@Configuration | ||
public class ClientApplicationConfiguration { | ||
|
||
@Bean | ||
MessageCracker messageCracker() { | ||
return new ClientMessageCracker(); | ||
} | ||
|
||
@Bean | ||
Application application(MessageCracker messageCracker) { | ||
return new ClientApplicationAdapter(messageCracker); | ||
} | ||
|
||
@Bean | ||
Initiator clientInitiator( | ||
Application clientApplication, | ||
MessageStoreFactory clientMessageStoreFactory, | ||
SessionSettings clientSessionSettings, | ||
LogFactory clientLogFactory, | ||
MessageFactory clientMessageFactory) throws ConfigError { | ||
return new ThreadedSocketInitiator(clientApplication, clientMessageStoreFactory, clientSessionSettings, | ||
clientLogFactory, clientMessageFactory); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...lient/src/main/java/org/quickfixj/examples/legacy/custom/client/ClientMessageCracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.quickfixj.examples.legacy.custom.client; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import quickfix.FieldNotFound; | ||
import quickfix.SessionID; | ||
import quickfix.field.*; | ||
import quickfix.fix50sp2.BusinessMessageReject; | ||
import quickfix.fix50sp2.ExecutionReport; | ||
import quickfix.fix50sp2.MessageCracker; | ||
import quickfix.fix50sp2.component.Instrument; | ||
|
||
public class ClientMessageCracker extends MessageCracker { | ||
private final Logger log = LoggerFactory.getLogger(ClientMessageCracker.class); | ||
|
||
@Override | ||
public void onMessage(ExecutionReport executionReport, SessionID sessionID) | ||
throws FieldNotFound { | ||
Instrument instrumentComponent = executionReport.getInstrument(); // invariant | ||
log.info("Received ExecutionReport from sender [{}]:: clOrdID {}, symbol {}, side {}, transactTime {}, ordType {}, securityIDSource {}, securityID {}", | ||
executionReport.getHeader().getString(SenderCompID.FIELD), | ||
instrumentComponent.getSymbol().getValue(), | ||
executionReport.getClOrdID().getValue(), | ||
executionReport.getSide().getValue(), | ||
executionReport.getTransactTime().getValue(), | ||
executionReport.getOrdType().getValue(), | ||
instrumentComponent.isSetSecurityIDSource() ? instrumentComponent.getSecurityIDSource().getValue() : "", | ||
instrumentComponent.isSetSecurityID() ? instrumentComponent.getSecurityID().getValue() : ""); | ||
} | ||
|
||
@Override | ||
public void onMessage(BusinessMessageReject businessMessageReject, SessionID sessionID) | ||
throws FieldNotFound { | ||
log.error("Received Business Message Reject from sender [{}]: refMsgType {}, businessRejectReason{}, Text {}", | ||
sessionID.getSenderCompID(), | ||
businessMessageReject.getRefMsgType().getValue(), | ||
businessMessageReject.getBusinessRejectReason().getValue(), | ||
businessMessageReject.isSetText() ? businessMessageReject.getText().getValue() : ""); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
custom-applications/using-legacy-codegen-client/src/main/resources/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
spring: | ||
main: | ||
allow-bean-definition-overriding: true | ||
|
||
server: | ||
port: 8083 | ||
|
||
management: | ||
endpoint: | ||
health: | ||
show-details: always | ||
quickfixjclient: | ||
enabled: true | ||
endpoints: | ||
web: | ||
exposure: | ||
include: quickfixjclient,health | ||
|
||
app: | ||
session: | ||
sender-comp-id: L-INITIATOR | ||
|
||
quickfixj: | ||
client: | ||
enabled: true | ||
configString: | | ||
[default] | ||
BeginString=FIXT.1.1 | ||
DefaultApplVerID=FIX.5.0SP2 | ||
UseDataDictionary=Y | ||
TransportDataDictionary=FIXT11.xml | ||
AppDataDictionary.FIX.5.0SP2=FIX50SP2.modified.xml | ||
ConnectionType=initiator | ||
TimeZone=Europe/London | ||
StartTime=00:00:00 | ||
EndTime=00:00:00 | ||
ResetOnLogon=Y | ||
ResetOnLogout=Y | ||
ResetOnDisconnect=Y | ||
ValidateUnorderedFields=Y | ||
ValidateUserDefinedFields=Y | ||
CheckLatency=Y | ||
HeartBtInt=30 | ||
PersistMessages=N | ||
SocketConnectHost=localhost | ||
SenderCompID=${app.session.sender-comp-id} | ||
#SSL | ||
SocketUseSSL=N | ||
[session] | ||
TargetCompID=L-ACCEPTOR | ||
SocketConnectPort=9882 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.quickfixj.custom.examples</groupId> | ||
<artifactId>custom-applications-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>using-legacy-codegen-server</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.allune</groupId> | ||
<artifactId>quickfixj-spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.allune</groupId> | ||
<artifactId>quickfixj-spring-boot-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.quickfixj</groupId> | ||
<artifactId>quickfixj-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.quickfixj</groupId> | ||
<artifactId>quickfixj-messages-fixt11</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.quickfixj.custom.examples</groupId> | ||
<artifactId>legacy-codegen-application-messages</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.