|
9 | 9 | import com.thomsonreuters.ema.access.GenericMsg;
|
10 | 10 | import com.thomsonreuters.ema.access.OmmConsumer;
|
11 | 11 | import com.thomsonreuters.ema.access.OmmConsumerClient;
|
| 12 | +import com.thomsonreuters.ema.access.OmmConsumerConfig; |
12 | 13 | import com.thomsonreuters.ema.access.OmmConsumerEvent;
|
13 | 14 | import com.thomsonreuters.ema.access.OmmState;
|
14 | 15 | import com.thomsonreuters.ema.access.ReqMsg;
|
@@ -57,6 +58,7 @@ public class ConsumerThread implements Runnable, OmmConsumerClient
|
57 | 58 | protected LatencyRandomArray _genMsgLatencyRandomArray; /* generic msg random latency array */
|
58 | 59 | private int _JVMPrimingRefreshCount; /* used to determine when JVM priming is complete */
|
59 | 60 | private OmmConsumer _consumer;
|
| 61 | + private OmmConsumerConfig _ommConfig; |
60 | 62 | private long _itemHandle;
|
61 | 63 |
|
62 | 64 | {
|
@@ -165,10 +167,24 @@ protected void initialize()
|
165 | 167 |
|
166 | 168 | protected void initializeOmmConsumer()
|
167 | 169 | {
|
168 |
| - if (_consPerfConfig.useUserDispatch()) |
169 |
| - _consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig().username(_consPerfConfig.username()).operationModel(OperationModel.USER_DISPATCH)); |
170 |
| - else |
171 |
| - _consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig().username(_consPerfConfig.username()).operationModel(OperationModel.API_DISPATCH)); |
| 170 | + try |
| 171 | + { |
| 172 | + _ommConfig = EmaFactory.createOmmConsumerConfig(); |
| 173 | + // A blank user name is an invalid input to OmmConsumerConfig.username and will trigger an invalid usage exception. |
| 174 | + if(_consPerfConfig.username().length() != 0) |
| 175 | + _ommConfig.username(_consPerfConfig.username()); |
| 176 | + |
| 177 | + if(_consPerfConfig.useUserDispatch()) |
| 178 | + _ommConfig.operationModel(OperationModel.USER_DISPATCH); |
| 179 | + else |
| 180 | + _ommConfig.operationModel(OperationModel.API_DISPATCH); |
| 181 | + |
| 182 | + _consumer = EmaFactory.createOmmConsumer(_ommConfig); |
| 183 | + } |
| 184 | + catch(Exception e) |
| 185 | + { |
| 186 | + System.out.println("Exception found"+e); |
| 187 | + } |
172 | 188 |
|
173 | 189 | _srcDirHandler.serviceName(_consPerfConfig.serviceName());
|
174 | 190 | long directoryHandle = _consumer.registerClient(_srcDirHandler.getRequest(), _srcDirHandler);
|
|
0 commit comments