hi everyone ,
can some one please help me how can i use openweathermap api for spark , kafka, cassandra streaming , i am done with normal stream , mean some dummy data from csv files now i want real time streaming, i found “https://github.com/snowplow/scala-weather” this one useful for getting data from openweathermap , but i am unable to find how to use this api , can any one please help me how can i use this api in order to get data for real time stream.If some one have example code for openweathermap , please do share.
// Create client
import com.snowplowanalytics.weather.providers.openweather.OwmAsyncClient
val client = OwmAsyncClient(YOURKEY)
// Get weather by coordinates
val response = client.currentByCoords(35, 139)
response.onSuccess { weather =>
println(weather)
}
Above, response is standard Scala stdlib Future, and weather is Either-like datatype, which either successful OwmResponse (you can inspect this class in IDE) or failure if JSON for example cannot be parsed.
Aside from OwmAsyncClient there’s also blocking OwmCacheClient.