Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Elektron /
  • EMA /
avatar image
Question by ashwathguru.s · Apr 06, 2020 at 12:42 PM · elektronrefinitiv-realtimeelektron-sdktreprrtema-apielektron-message-api

We are faicng error while using EMA Code : error: type mismatch. Please assist

We are using decode function as is mentioned in the website in REPL mode


import com.thomsonreuters.ema.access.Data

import com.thomsonreuters.ema.access.DataType;

import com.thomsonreuters.ema.access.DataType.DataTypes

import com.thomsonreuters.ema.access.EmaFactory

import com.thomsonreuters.ema.access.FieldEntry

import com.thomsonreuters.ema.access.FieldList


def decode(fieldList: FieldList){

fieldList.forEach( fieldEntry => { print("\tFid: " + fieldEntry.fieldId() + " Name: " + fieldEntry.name() + " DataType: " + DataType.asString(fieldEntry.load().dataType()) + " Value: ")

})

}


but it throws error as below for highlighted part.


<console>:85: error: missing parameter type.


We tried multiple approaches but no luck.


def decode(fieldList: FieldList){

fieldList.forEach( (fieldEntry:FieldEntry) => { print("\tFid: " + fieldEntry.fieldId() + " Name: " + fieldEntry.name() + " DataType: " + DataType.asString(fieldEntry.load().dataType()) + " Value: ")

})

}


<console>:86: error: type mismatch;

found : com.thomsonreuters.ema.access.FieldEntry => Unit

required: java.util.function.Consumer[_ >: com.thomsonreuters.ema.access.FieldEntry]

{ fieldList.forEach( (fieldEntry:FieldEntry) => { print("\tFid: " + fieldEntry.fieldId() + " Name: " + fieldEntry.name() + " DataType: " + DataType.asString(fieldEntry.load().dataType()) + " Value: ")


People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

5 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Gurpreet · Apr 06, 2020 at 01:46 PM

Hi @ashwathguru.s,

You can follow the decode example as shown in the samples packaged with SDK like - series200\example200__MarketPrice__Streaming\Consumer.java, or follow the step by step EMA Java decoding tutorial.

If there is still an issue, please post you complete code and we can take a peek at it. Thanks.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
Answer by ashwathguru.s · Apr 07, 2020 at 03:07 AM

Hi,


We are using Scala. The code we are referring is mentioned here


https://developers.refinitiv.com/article/get-real-time-market-data-using-ema-java-scala-language


As mentioned, decode(fieldList: FieldList) is failing with given error.


We are running this in scala interpreter and trying to run forEach loop to extract each single field and use it for further purpose.



class AppClient extends OmmConsumerClient {

def onRefreshMsg(refreshMsg: RefreshMsg,event: OmmConsumerEvent) {

println("Refresh Message of: " +

(if (refreshMsg.hasName()) refreshMsg.name()

else "<not set>"))

println("Service Name: " +

(if (refreshMsg.hasServiceName()) refreshMsg.serviceName()

else "<not set>"))

println("Item State: " + refreshMsg.state());

//println(refreshMsg)

val a = refreshMsg.payload().fieldList().size

println(a)

decode(refreshMsg.payload().fieldList())

}

def decode(fieldList: FieldList){

fieldList.forEach((fieldEntry:FieldEntry) => {

print("\tFid: " + fieldEntry.fieldId() + " Name: " + fieldEntry.name() + " DataType: " + DataType.asString(fieldEntry.load().dataType()) + " Value: ")

})

}


def onUpdateMsg(updateMsg: UpdateMsg,event: OmmConsumerEvent) {

println("Update Message of: " +

(if (updateMsg.hasName()) updateMsg.name()

else "<not set>"))

println("Service Name: " +

(if (updateMsg.hasServiceName()) updateMsg.serviceName()

else "<not set>"))

println(updateMsg)

}

def onStatusMsg(statusMsg: StatusMsg,event: OmmConsumerEvent) {

println("Status Message of:" +

(if (statusMsg.hasName()) statusMsg.name()

else "<not set>"))

println("Service Name: " +

(if (statusMsg.hasServiceName()) statusMsg.serviceName()

else "<not set>"))

if (statusMsg.hasState())

println("Item State: " + statusMsg.state())

println()

}

def onGenericMsg(genericMsg: GenericMsg,event: OmmConsumerEvent) { }

def onAckMsg(ackMsg: AckMsg,event: OmmConsumerEvent) { }

def onAllMsg(msg: Msg,event: OmmConsumerEvent) { }

}


var myapp = new AppClient

var consumer: OmmConsumer = null

val appClient: AppClient = new AppClient()

val config: OmmConsumerConfig = EmaFactory.createOmmConsumerConfig()

consumer = EmaFactory.createOmmConsumer(config.host("test").username("test"));

val reqMsg = EmaFactory.createReqMsg();

var itemNames: scala.collection.mutable.Set[String] = Set("INR=")

var domainType: Int = EmaRdm.MMT_MARKET_PRICE

consumer.registerClient(reqMsg.serviceName("test").domainType(domainType).name(itemNames.head), appClient)

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by Gurpreet · Apr 07, 2020 at 01:13 PM

Are you using Consumer.scala sample without any modifications?

@Pimchaya.Wongrukun can you please help with this code snippet.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by pimchaya.wongrukun01 · Apr 08, 2020 at 01:49 AM

Hello @ashwathguru.s

You can see an example of EMA Consumer in the Scala language from this article.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by pimchaya.wongrukun01 · Apr 14, 2020 at 04:07 AM

Hello @ashwathguru.s

Based on your given source code, I have tested it with Elektron SDK 1.5.0.L1 and it worked properly without any problem. The complete source code is ConsumerClient.txt, please try it with Elektron SDK 1.5.0.L1

If the problem still occurs with my given source code and Elektron SDK 1.5.0.L1, please share the following info:

  1. EMA xml trace log when the problem occurs. EMA will trace sent and received message between EMA and the server when set XmlTraceToStdout in Consumer node to be 1. For example:

<Consumer>

<Name value="Consumer_1"/>

…

<XmlTraceToStdout value="1"/>

</Consumer>

2. EMA configuration file (EmaConfig.xml)


consumerclient.txt (3.4 KiB)
Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
wasin.w ♦♦ · Apr 21, 2020 at 06:28 AM 0
Share

Hello @ashwathguru.s

Do you have a chance to test with ESDK 1.5.0 L1?

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
11 People are following this question.

Related Questions

mock Refresh/UpdateMsg ?

Does EMA API support connecting to TREP which is version of 2.6?

EMA 配置文件位置

Login Domain - Components and Elements in Login responses

Indications of problems with infrastructure

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges