How to setup initiator with modified SenderCompID value?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to setup initiator with modified SenderCompID value?

martyix
This post has NOT been accepted by the mailing list yet.
Hi,

I have a `quickfix-client.properties` file with the following contents:


```
[default]
HeartBtInt=30
StartTime=00:00:00
EndTime=00:00:00
FileStorePath=data/trading/messages
ReconnectInterval=5
UseDataDictionary=Y
FileLogPath=data/trading
DataDictionary=trading/FIX42.xml
SocketUseSSL=Y
# Client API key (on messages from the client)
# The property has to be in "default" session to be correctly overriden in code.
SenderCompID=SUBJECT_TO_CHANGE         <----- THIS IS IMPORTANT LINE

[session]
BeginString=FIX.4.2
ConnectionType=initiator
SocketConnectHost=some.server.com
SocketConnectPort=4198

TargetCompID=SomethingHere
ResetOnDisconnect=Y
ResetOnLogout=Y
ResetOnLogon=Y
```

and now when I setup SocketInitiator class I do:

```
SessionSettings settings = new SessionSettings(inputStream); // inputStream corresponds with the config file above

// <SOLUTION_I_TRIED>
// This does not seem to be the proper way to change SenderCompID. Why?
settings.getDefaultProperties().setProperty("SenderCompID", this.accessKey);
// This does not seem to be the proper way to change SenderCompID. Why?
settings.setString("SenderCompID", this.accessKey);
// </SOLUTION_I_TRIED>

logger.debug("Settings: {}", settings); // the value of SenderCompID is this.accessKey which is correct. However log file name contains "SUBJECT_TO_CHANGE" instead of `this.accessKey` value.
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();

this.initiator = new SocketInitiator(this.application, storeFactory, settings, logFactory, messageFactory);

logger.debug("initiator.start()");
this.initiator.start();
```


How can I change <SOLUTION_I_TRIED> section to modify SenderCompID value?

Thank you!

Best regards,
Martin