Trying to use scala-weather in a Spark Streaming app

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.

Thanks

Hi @matesio,

  1. You’ll need to get API key from OpenWeatherMap by signing up on their website
  2. Here’s brief post explaining scala-weather usage: https://snowplowanalytics.com/blog/2015/12/13/scala-weather-0.1.0-released/#usage
  3. Here’ brief explanation:
// 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.

Thanks sir

[error] required: PartialFunction[scalaz./[com.snowplowanalytics.weather.providers.openweather.Errors.WeatherError,com.snowplowanalytics.weather.providers.openweather.Responses.Current],?]
[error] response.onSuccess { weather =>
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 4 s, completed Jul 19, 2017 11:00:41 AM

It is giving me error