Skip to content

Commit

Permalink
[TS-1616] Merge pull request #3 from th2-net/TS-1616
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro authored Jul 3, 2024
2 parents 20f4f82 + 4e304f0 commit 7721304
Show file tree
Hide file tree
Showing 52 changed files with 5,582 additions and 654 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-sanpshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and publish Docker image to Github Container Registry ghcr.io
on:
push:
branches-ignore:
- master
- main
- version-*
- dependabot**
paths-ignore:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:7.1-jdk11 AS build
FROM gradle:7.6-jdk11 AS build
ARG release_version
COPY ./ .
RUN gradle --no-daemon clean build dockerPrepare -Prelease_version=${release_version}
Expand Down
60 changes: 55 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# th2-conn-dirty-fix (1.0.0)
# th2-conn-dirty-fix (1.2.0)

This microservice allows sending and receiving messages via FIX protocol

Expand Down Expand Up @@ -30,8 +30,9 @@ This microservice allows sending and receiving messages via FIX protocol
+ *senderSubID* - assigned value used to identify specific message originator (desk, trader, etc.)
+ *encryptMethod* - encryption method
+ *username* - user name
+ *password* - user password. FIX client uses the Password(554) tag for unencrypted mode and the EncryptedPassword(1402) tag for encrypted. The encryption is enabled via *passwordEncryptKeyFilePath* option.
+ *newPassword* - user new password. FIX client uses the NewPassword(925) tag for unencrypted mode and the NewEncryptedPassword(1404) tag for encrypted. The encryption is enabled via *passwordEncryptKeyFilePath* option.
+ *password* - user password. FIX client uses the Password(554) tag for unencrypted mode and the EncryptedPassword(1402) tag for encrypted. The encryption is enabled via *passwordEncryptKeyFilePath* option. It is a good practice to pass this variable as kubernetes secret.
+ *newPassword* - user new password. FIX client uses the NewPassword(925) tag for unencrypted mode and the NewEncryptedPassword(1404) tag for encrypted. The encryption is enabled via *passwordEncryptKeyFilePath* option. It is a good practice to pass this variable as kubernetes secret.
+ *previousPasswords* - comma-separated list of passwords used for this user before.
+ *passwordEncryptKeyFilePath* - path to key file for encrypting. FIX client encrypts the *password* value via `RSA` algorithm using specified file if this option is specified.
+ *passwordEncryptKeyFileType* - type of key file content. Supported values: `[PEM_PUBLIC_KEY]`. Default value is `PEM_PUBLIC_KEY`
+ *passwordKeyEncryptAlgorithm* - encrypt algorithm for reading key from file specified in the *passwordEncryptKeyFilePath*. See the KeyFactory section in the [Java Cryptography Architecture Standard Algorithm Name](https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#KeyFactory) for information about standard algorithm names. Default value is `RSA`
Expand All @@ -42,10 +43,20 @@ This microservice allows sending and receiving messages via FIX protocol
+ *resetSeqNumFlag* - resetting sequence number in initial Logon message (when conn started)
+ *resetOnLogon* - resetting the sequence number in Logon in other cases (e.g. disconnect)
+ *loadSequencesFromCradle* - defines if sequences will be loaded from cradle to use them in logon message.
+ *loadMissedMessagesFromCradle* - defines how retransmission will be handled. If true, then requested through `ResendRequest` messages (or messages requested on Logon with `NextExpectedSeqNum`) will be loaded from cradle.
+ *sessionStartTime* - UTC time when session starts. (`nullable`)
+ *sessionEndTime* - UTC time when session ends. required if startSessionTime is filled.
+ *sendingDateTimeFormat* - `SendingTime` field format for outgoing messages. (`nullable`, `default format` in this case is `"yyyyMMdd-HH:mm:ss.SSSSSSSSS"`)
+ *useNextExpectedSeqNum* - session management based on next expected sequence number. (`false` by default)
+ *saveAdminMessages* - defines if admin messages will be saved to internal outgoing buffer. (`false` by default)
+ *resetStateOnServerReset* - whether to reset the server sequence after receiving logout with text `Next Expected MSN too high, MSN to be sent is x but received y`.
+ *logoutOnIncorrectServerSequence* - whether to logout session when server send message with sequence number less than expected. If `false` then internal conn sequence will be reset to sequence number from server message.
+ *connectionTimeoutOnSend* - timeout in milliseconds for sending message from queue thread
(please read about [acknowledgment timeout](https://www.rabbitmq.com/consumers.html#acknowledgement-timeout) to understand the problem).
_Default, 30000 mls._ Each failed sending attempt decreases the timeout in half (but not less than _minConnectionTimeoutOnSend_).
The timeout is reset to the original value after a successful sending attempt.
If connection is not established within the specified timeout an error will be reported.
+ *minConnectionTimeoutOnSend* - minimum value for the sending message timeout in milliseconds. _Default value is 1000 mls._

### Security settings

Expand Down Expand Up @@ -275,7 +286,7 @@ spec:
- remove: { tag: 110, matches: (.*) }
update-checksum: false
pins:
- name: to_data_provider
- name: to_data_provider
connection-type: grpc-client
service-class: com.exactpro.th2.dataprovider.grpc.DataProviderService
- name: to_send
Expand Down Expand Up @@ -325,10 +336,49 @@ spec:

# Changelog

## 1.0.0
## 1.2.0
* Added support for th2 transport protocol
* Header tags are forced to update by conn
* Merged changes from [th2-conn-dirty-fix:1.5.1](https://github.com/th2-net/th2-conn-dirty-fix)

## 1.1.0
* state reset option on server update.

## 1.0.2
* dev releases
* apply changes from version-0

## 1.0.1
* Add bookId to lw data provider query

## 1.0.0
* Bump `conn-dirty-tcp-core` to `3.0.0` for books and pages support

## 0.3.0
* Ability to recover messages from cradle.

## 0.2.0
* optional state reset on silent server reset.

## 0.1.1
* correct sequence numbers increments.
* update conn-dirty-tcp-core to `2.3.0`

## 0.1.0
* correct handling of sequence reset with `endSeqNo = 0`
* Skip messages mangling on error in `demo-fix-mangler` with error event instead of throwing exception.
* allow unconditional rule application

## 0.0.10
* disable reconnect when session is in not-active state.

## 0.0.9
* correct heartbeat and test request handling

## 0.0.8

* th2-common upgrade to `3.44.1`
* th2-bom upgrade to `4.2.0`

## 0.0.7

Expand Down
117 changes: 84 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.JsonReportRenderer

plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'com.palantir.docker' version '0.25.0'
id "org.owasp.dependencycheck" version "8.3.1"
id "com.gorylenko.gradle-git-properties" version "2.4.1"
id 'com.github.jk1.dependency-license-report' version '2.5'
id "de.undercouch.download" version "5.4.0"
}

apply plugin: 'application'
Expand All @@ -14,15 +23,7 @@ version release_version
sourceCompatibility = 11
targetCompatibility = 11

ext {
sharedDir = file("${project.rootDir}/shared")
}

repositories {
maven {
name 'MavenLocal'
url sharedDir
}
mavenCentral()

maven {
Expand All @@ -37,37 +38,45 @@ repositories {

mavenLocal()

configurations.all {
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
}

dependencies {
api platform('com.exactpro.th2:bom:4.1.0')
api platform('com.exactpro.th2:bom:4.5.0')

implementation 'com.exactpro.th2:common:5.1.0-dev-version-5-4085018593-8adee33-SNAPSHOT'
implementation 'com.exactpro.th2:netty-bytebuf-utils:0.0.1'
implementation('com.exactpro.th2:conn-dirty-tcp-core:3.0.0-dev-version-3-4184093805-SNAPSHOT') {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
because 'Projects should use only slf4j-api, without coupling to a certain implementation'
implementation("com.exactpro.th2:common:5.4.0-dev") {
exclude group: 'com.exactpro.th2', module: 'task-utils'
}
implementation 'com.exactpro.th2:grpc-lw-data-provider:2.0.0-dev-version-2-4112857941-SNAPSHOT'
implementation group: 'com.exactpro.th2', name: 'common-utils', version: '2.2.1-dev'

implementation 'com.exactpro.th2:netty-bytebuf-utils:0.0.1'
implementation 'net.lingala.zip4j:zip4j:2.11.5'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'

implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2'

implementation 'com.exactpro.th2:conn-dirty-tcp-core:3.4.0-dev'
implementation 'com.exactpro.th2:grpc-lw-data-provider:2.2.0-dev'

implementation 'org.slf4j:slf4j-api'
implementation 'io.github.microutils:kotlin-logging:2.1.23'
implementation 'io.github.microutils:kotlin-logging:3.0.0' // The last version bases on kotlin 1.6.0
implementation 'org.apache.commons:commons-lang3'

implementation 'io.netty:netty-all:4.1.86.Final'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21'
implementation 'io.netty:netty-all'
implementation 'com.google.auto.service:auto-service:1.0.1'

implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jackson_version
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jackson_version
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jackson_version
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jackson_version
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'

testImplementation 'org.mockito:mockito-core:5.4.0'
testImplementation 'org.mockito:mockito-all:1.10.19'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5:1.7.10'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5:1.8.10'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.3'
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.1.0'

annotationProcessor 'com.google.auto.service:auto-service:1.0.1'
kapt 'com.google.auto.service:auto-service:1.0.1'
Expand All @@ -78,13 +87,13 @@ test {
}

application {
mainClassName 'com.exactpro.th2.conn.dirty.tcp.core.Main'
mainClass.set('com.exactpro.th2.conn.dirty.tcp.core.Main')
}

applicationName = 'service'

distTar {
archiveName "${applicationName}.tar"
archiveFileName.set("${applicationName}.tar")
}

dockerPrepare {
Expand All @@ -95,14 +104,56 @@ docker {
copySpec.from(tarTree("$buildDir/distributions/${applicationName}.tar"))
}

compileKotlin {
kotlinOptions {
jvmTarget = '11'
tasks.withType(KotlinCompile).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = '11'
test {
testLogging {
events "passed", "skipped", "failed"
// You can adjust the logging level as needed
exceptionFormat "full"
showStandardStreams = true
}
}

dependencyCheck {
formats=['SARIF', 'JSON', 'HTML']
failBuildOnCVSS=5
suppressionFile="suppressions.xml"

//FIXME: we should check all used dependencies
skipConfigurations = ['kapt', 'kaptClasspath_kaptKotlin', 'kaptTest', 'kaptTestFixtures', 'annotationProcessor']
analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}

dependencyLocking {
lockAllConfigurations()
}

licenseReport {
def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json"

if (!file(licenseNormalizerBundlePath).exists()) {
download.run {
src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
dest "$buildDir/license-normalizer-bundle.json"
overwrite false
}
}

filters = [
new LicenseBundleNormalizer(licenseNormalizerBundlePath, false)
]
renderers = [
new JsonReportRenderer('licenses.json', false),
]
excludeOwnGroup = false
allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json")
}
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
release_version=1.0.0
jackson_version=2.11.2
release_version=1.2.0
Loading

0 comments on commit 7721304

Please sign in to comment.