Skip to content

Commit

Permalink
add configuration for send resend request
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Plotnikov committed Nov 22, 2023
1 parent 15352d9 commit c1f9eef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/main/java/com/exactpro/th2/FixHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.RecoveryConfig;
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.ResendRequestConfiguration;
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.RuleConfiguration;
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.SendSequenceResetConfiguration;
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.SplitSendConfiguration;
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.TransformMessageConfiguration;
import com.exactpro.th2.conn.dirty.fix.brokenconn.configuration.TransformationConfiguration;
Expand Down Expand Up @@ -1921,12 +1922,19 @@ private void runReconnectWithSequenceResetStrategy(RuleConfiguration configurati
private void sendSequenceReset(RuleConfiguration configuration) {
strategy.resetStrategyAndState(configuration);
Instant start = Instant.now();
SendSequenceResetConfiguration config = configuration.getSendSequenceResetConfiguration();

StringBuilder sequenceReset = new StringBuilder();
String time = getTime();
setHeader(sequenceReset, MSG_TYPE_SEQUENCE_RESET, msgSeqNum.incrementAndGet(), time);
sequenceReset.append(ORIG_SENDING_TIME).append(time);
sequenceReset.append(NEW_SEQ_NO).append(msgSeqNum.get() - 5);
if(config.getChangeUp()) {
int seqNum = msgSeqNum.get();
sequenceReset.append(NEW_SEQ_NO).append(seqNum + 5);
msgSeqNum.set(seqNum + 5);
} else {
sequenceReset.append(NEW_SEQ_NO).append(msgSeqNum.get() - 5);
}
setChecksumAndBodyLength(sequenceReset);

channel.send(Unpooled.wrappedBuffer(sequenceReset.toString().getBytes(StandardCharsets.UTF_8)), new HashMap<String, String>(), null, SendMode.HANDLE_AND_MANGLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ data class RuleConfiguration(
val batchSendConfiguration: BatchSendConfiguration? = null,
val splitSendConfiguration: SplitSendConfiguration? = null,
val changeSequenceConfiguration: ChangeSequenceConfiguration? = null,
val resendRequestConfiguration: ResendRequestConfiguration? = null
val resendRequestConfiguration: ResendRequestConfiguration? = null,
val sendSequenceResetConfiguration: SendSequenceResetConfiguration? = null
) {
init {
when(ruleType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.exactpro.th2.conn.dirty.fix.brokenconn.configuration

data class SendSequenceResetConfiguration(val changeUp: Boolean)

0 comments on commit c1f9eef

Please sign in to comment.