Hello All,

I need some help making async API calls. I have tried the following code
below.

class AsyncWeatherAPIRequest extends AsyncFunction[String, String] {
  override def asyncInvoke(input: String, resultFuture:
ResultFuture[String]): Unit = {
    val query = url("<External API URL>")
    val response = Http.default(query OK as.String)
    resultFuture.complete(Collections.singleton(response()))
  }
}

The code below leads to a compilation issue while calling the
AsyncDataStream api.

    val resultStream: DataStream[(String, String)] =
      AsyncDataStream.unorderedWait(userData, new AsyncWeatherAPIRequest(),
1000, TimeUnit.MILLISECONDS, 1)

I would really appreciate some examples in scala to make an external API
call with datastreams.

Regards,
Krishna

-- 
Standorte in Stuttgart und Berlin <http://www.zoi.de/#kontakt> · Zoi 
TechCon GmbH · Quellenstr. 7 · 70376 Stuttgart · Geschäftsführer: Benjamin 
Hermann, Dr. Daniel Heubach. Amtsgericht Stuttgart HRB 759619, 
Gerichtsstand Stuttgart. Die genannten Angaben werden automatisch 
hinzugefügt und lassen keine Rückschlüsse auf den Rechtscharakter der 
E-Mail zu. This message (including any attachments) contains confidential 
information intended for a specific individual and purpose, and is 
protected by law. If you are not the intended recipient, you should delete 
this message. Any disclosure, copying, or distribution of this message, or 
the taking of any action based on it, is strictly prohibited.


Reply via email to