21
21
import com .epam .cme .mdp3 .sbe .schema .MdpMessageTypes ;
22
22
import org .slf4j .Logger ;
23
23
import org .slf4j .LoggerFactory ;
24
+ import org .agrona .collections .IntHashSet ;
24
25
25
26
import java .util .List ;
26
27
import java .util .function .Consumer ;
@@ -39,6 +40,7 @@ public class ChannelControllerRouter implements MdpChannelController {
39
40
private final String channelId ;
40
41
private List <Integer > mboIncrementMessageTemplateIds ;
41
42
private List <Integer > mboSnapshotMessageTemplateIds ;
43
+ private IntHashSet securityIds = new IntHashSet ();
42
44
43
45
public ChannelControllerRouter (String channelId , InstrumentManager instrumentManager ,
44
46
MdpMessageTypes mdpMessageTypes , List <ChannelListener > channelListeners ,
@@ -131,14 +133,25 @@ protected void routeMBPEntry(int securityId, MdpMessage mdpMessage, MdpGroupEntr
131
133
}
132
134
}
133
135
136
+ protected void routeIncrementalComplete (IntHashSet securityIds , MdpMessage mdpMessage , long msgSeqNum ) {
137
+ for (int securityId : securityIds ) {
138
+ InstrumentController instrumentController = instrumentManager .getInstrumentController (securityId );
139
+ if (instrumentController != null ) {
140
+ instrumentController .handleIncrementalComplete (mdpMessage , msgSeqNum );
141
+ }
142
+ }
143
+ }
144
+
134
145
private void handleIncrementalMessage (MdpMessage mdpMessage , MdpGroup mdpGroup , MdpGroupEntry mdpGroupEntry , long msgSeqNum ){
135
146
if (isIncrementalMessageSupported (mdpMessage )) {
147
+ securityIds .clear ();
136
148
if (isIncrementOnlyForMBO (mdpMessage )) {
137
149
mdpMessage .getGroup (MdConstants .NO_MD_ENTRIES , mdpGroup );
138
150
while (mdpGroup .hashNext ()) {
139
151
mdpGroup .next ();
140
152
mdpGroup .getEntry (mdpGroupEntry );
141
153
int securityId = getSecurityId (mdpGroupEntry );
154
+ securityIds .add (securityId );
142
155
routeMBOEntry (securityId , mdpMessage , mdpGroupEntry , null , msgSeqNum );
143
156
}
144
157
} else {
@@ -151,6 +164,7 @@ private void handleIncrementalMessage(MdpMessage mdpMessage, MdpGroup mdpGroup,
151
164
emptyBookConsumers .forEach (mdpMessageConsumer -> mdpMessageConsumer .accept (mdpMessage ));
152
165
} else {
153
166
int securityId = mdEntry .getInt32 (MdConstants .SECURITY_ID );
167
+ securityIds .add (securityId );
154
168
routeMBPEntry (securityId , mdpMessage , mdEntry , msgSeqNum );
155
169
}
156
170
}
@@ -163,10 +177,12 @@ private void handleIncrementalMessage(MdpMessage mdpMessage, MdpGroup mdpGroup,
163
177
short entryNum = mdpGroupEntry .getUInt8 (MdConstants .REFERENCE_ID );
164
178
noMdEntriesGroup .getEntry (entryNum , mdEntry );
165
179
int securityId = mdEntry .getInt32 (MdConstants .SECURITY_ID );
180
+ securityIds .add (securityId );
166
181
routeMBOEntry (securityId , mdpMessage , mdpGroupEntry , mdEntry , msgSeqNum );
167
182
}
168
183
}
169
184
}
185
+ routeIncrementalComplete (securityIds , mdpMessage , msgSeqNum );
170
186
}
171
187
}
172
188
0 commit comments