question

Upvotes
Accepted
20 6 7 10

EMA Programmatic configuration in Java - unable to set Dictionary related elements

We're having trouble using EMA programmatic configuration in Java for the Dictionary related elements as part of a TRCC application

1) Using the example code we're able to connect to TRCC when specifying local RDMFieldDictionary & enumtype.def files (we can't get Channel method to work but not important right now) when using the an xml ema config file

2) Running the same code but programmatically setting the various parameters fails with the following:

Apr 22, 2020 2:43:55 PM com.thomsonreuters.ema.access.ConfigErrorTracker log
WARNING: loggerMsg
    ClientName: EmaConfig
    Severity: Warning
    Text:    no configuration exists in the config file for consumer dictionary [DictionaryGroup|DictionaryList]. Will use dictionary defaults if not config programmatically.
loggerMsgEndApr 22, 2020 2:43:55 PM com.thomsonreuters.ema.access.ConfigErrorTracker log
SEVERE: loggerMsg
    ClientName: EmaConfig
    Severity: Error
    Text:    no conversion in convertToEnum for enumType [FieldDictionary]
loggerMsgEndApr 22, 2020 2:43:57 PM com.thomsonreuters.ema.access.ChannelCallbackClient reactorChannelEventCallback
INFO: loggerMsg
    ClientName: ChannelCallbackClient
    Severity: Info
    Text:    Received ChannelUp event on channel Channel_1
        Instance Name Consumer_1_1
        Component Version eta3.1.1.L1.linux.rrg 64-bit Static
loggerMsgEndApr 22, 2020 2:44:42 PM com.thomsonreuters.ema.access.OmmConsumerImpl loadDictionary
SEVERE: loggerMsg
    ClientName: Consumer_1_1
    Severity: Error
    Text:    dictionary retrieval failed (timed out after waiting 45000 milliseconds) for
loggerMsgEnd

3) We're using the EMAJ_Config guide examples as our guide but are clearly missing something. Java code is as follows:

import com.thomsonreuters.ema.access.*;

import com.thomsonreuters.ema.rdm.EmaRdm;


import java.io.FileInputStream;

import java.io.InputStream;

import java.util.Properties;


public class EMATestContributor {


public static void main(String[] args) {

if (args.length < 1) {

System.out.println("Must provide config file name");

return;

}



try {

InputStream input = new FileInputStream(args[0]);

Properties prop = new Properties();

prop.load(input);

String hostAndPort = prop.getProperty("host_port");

String login = prop.getProperty("login");

String password = prop.getProperty("password");

String tunnel_name = prop.getProperty("tunnel_name");

String service_name = prop.getProperty("service_name");

String keystore_file_name = prop.getProperty("keystore_file");

String keystore_file_pwd = prop.getProperty("keystore_pwd");

String dictionaryFilePath = prop.getProperty("dictionary_file");

String enumFilePath = prop.getProperty("enum_file");

//String xmlConfigPath = prop.getProperty("xml_config");


System.out.println("Contributing to TR Contributions Channel");

AppClient appClient = new AppClient(login, password);


System.out.println("Starting encrypted connection...");

// Create an OMM consumer


Map innerMap = EmaFactory.createMap();

Map configMap = EmaFactory.createMap();

ElementList elementList = EmaFactory.createElementList();

ElementList innerElementList = EmaFactory.createElementList();


elementList.add(EmaFactory.createElementEntry().ascii("DefaultConsumer", "Consumer_1"));

innerElementList.add(EmaFactory.createElementEntry().ascii("Channel", "Channel_1"));

innerElementList.add(EmaFactory.createElementEntry().ascii("Dictionary", "Dictionary_1"));

innerMap.add(EmaFactory.createMapEntry().keyAscii( "Consumer_1", MapEntry.MapAction.ADD,

innerElementList));

innerElementList.clear();


elementList.add(EmaFactory.createElementEntry().map( "ConsumerList", innerMap ));

innerMap.clear();

configMap.add(EmaFactory.createMapEntry().keyAscii( "ConsumerGroup", MapEntry.MapAction.ADD,

elementList ));

elementList.clear();


String[] hp = hostAndPort.split(":");


innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelType",

"ChannelType::RSSL_SOCKET"));

innerElementList.add(EmaFactory.createElementEntry().ascii("Host", hp[0]));

innerElementList.add(EmaFactory.createElementEntry().ascii("Port", hp[1]));

innerMap.add(EmaFactory.createMapEntry().keyAscii( "Channel_1", MapEntry.MapAction.ADD,

innerElementList));

innerElementList.clear();



elementList.add(EmaFactory.createElementEntry().map( "ChannelList", innerMap ));

innerMap.clear();


configMap.add(EmaFactory.createMapEntry().keyAscii( "ChannelGroup", MapEntry.MapAction.ADD,

elementList ));

elementList.clear();


innerElementList.add(EmaFactory.createElementEntry().ascii("DictionaryType",

"DictionaryType::FieldDictionary"));

innerElementList.add(EmaFactory.createElementEntry().ascii("RdmFieldDictionaryFileName", dictionaryFilePath));

innerElementList.add(EmaFactory.createElementEntry().ascii("EnumTypeDefFileName", enumFilePath));

innerMap.add(EmaFactory.createMapEntry().keyAscii( "Dictionary_1", MapEntry.MapAction.ADD,

innerElementList));

innerElementList.clear();


elementList.add(EmaFactory.createElementEntry().map( "DictionaryList", innerMap ));

configMap.add(EmaFactory.createMapEntry().keyAscii( "DictionaryGroup", MapEntry.MapAction.ADD,

elementList ));

elementList.clear();


OmmConsumer consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig()

.config(configMap)

.tunnelingKeyStoreFile(keystore_file_name)

.tunnelingKeyStorePasswd(keystore_file_pwd)

);


ClassOfService cos = EmaFactory.createClassOfService().

authentication(EmaFactory.createCosAuthentication().type(CosAuthentication.CosAuthenticationType.NOT_REQUIRED))

.dataIntegrity(EmaFactory.createCosDataIntegrity().type(CosDataIntegrity.CosDataIntegrityType.RELIABLE))

.flowControl(EmaFactory.createCosFlowControl().type(CosFlowControl.CosFlowControlType.BIDIRECTIONAL).recvWindowSize(1200))

.guarantee(EmaFactory.createCosGuarantee().type(CosGuarantee.CosGuaranteeType.NONE));


System.out.println("Starting tunnel stream...");

// Create a request for a tunnel stream

TunnelStreamRequest tsr = EmaFactory.createTunnelStreamRequest()

.classOfService(cos)

.domainType(EmaRdm.MMT_SYSTEM)

.name(tunnel_name)

.serviceName(service_name);


// Send the request and register for events from tunnel stream

long tunnelStreamHandle = consumer.registerClient(tsr, appClient);

appClient.setOmmConsumer(consumer);

appClient.setTunnelHandle(tunnelStreamHandle);


Thread.sleep(60000);

} catch (Exception excp) {

System.out.println(excp.getMessage());

}

}

}


elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apijavaconfigurationelektron-data-dictionary
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
53k 137 44 63

@Paul.Wuethrich2

The DictionaryType must be "DictionaryType::FileDictionary" or "DictionaryType::ChannelDictionary".

If the application loads dictionary from local files, the value of DictionaryType must be DictionaryType::FileDictionary.

innerElementList.add(EmaFactory.createElementEntry().ascii("DictionaryType", "DictionaryType::FileDictionary"));
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
20 6 7 10

Thanks and apologies - two pairs of eyes missed that! Connected now though we still have a warning


Apr 23, 2020 8:15:03 AM com.thomsonreuters.ema.access.ConfigErrorTracker log
WARNING: loggerMsg
    ClientName: EmaConfig
    Severity: Warning
    Text:    no configuration exists in the config file for consumer dictionary [DictionaryGroup|DictionaryList]. Will use dictionary defaults if not config programmatically.
loggerMsgEndApr 23, 2020 8:15:08 AM com.thomsonreuters.ema.access.ChannelCallbackClient reactorChannelEventCallback
INFO: loggerMsg
    ClientName: ChannelCallbackClient
    Severity: Info
    Text:    Received ChannelUp event on channel Channel_1
        Instance Name Consumer_1_1
        Component Version eta3.1.1.L1.linux.rrg 64-bit Static
loggerMsgEndStarting tunnel stream...
----- Status message ----
StatusMsg
    streamId="5"
    domain="System Domain"
    privateStream
    state="Open / Ok / None / ''"
    name="tunnelA"
    serviceId="10"
    serviceName="DDS_TRCE"
StatusMsgEndSending client login request...
----- Refresh message ----
RefreshMsg
    streamId="5"
    domain="System Domain"
    solicited
    RefreshComplete
    privateStream
    state="Open / Ok / None / 'Login accepted by host c170nctdpca06'"
    itemGroup="00 00"
    name="GE-A-00707661-3-2947"
    serviceId="10"
    Attrib dataType="ElementList"
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

From the warning text, it makes sense because the application programmatically configures the DictionaryGroup and DictionaryList instead of using the configuration file.