-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OpenSky flight state producer (#67)
* Add OpenSky flight state producer * scalafix <3 * Add producers base url default value * Extract collectRightMessagesGraph in a separate function * Start polling from open sky immediatly
- Loading branch information
Showing
25 changed files
with
526 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/scala/it/bitrock/dvs/producer/aviationedge/config/ApiProviderConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package it.bitrock.dvs.producer.aviationedge.config | ||
|
||
import java.net.URI | ||
import java.time.DayOfWeek | ||
|
||
import akka.http.scaladsl.model.Uri | ||
import pureconfig.ConfigSource | ||
import pureconfig.generic.auto._ | ||
|
||
final case class ApiProviderConfig(aviationEdge: AviationConfig, openSky: OpenSkyConfig) | ||
|
||
final case class AviationConfig( | ||
host: URI, | ||
key: String, | ||
apiTimeout: Int, | ||
flightSpeedLimit: Int, | ||
tickSource: TickSourceConfig, | ||
flightStream: ApiProviderStreamConfig, | ||
airplaneStream: ApiProviderStreamConfig, | ||
airportStream: ApiProviderStreamConfig, | ||
airlineStream: ApiProviderStreamConfig, | ||
cityStream: ApiProviderStreamConfig | ||
) { | ||
def getAviationUri(path: String): String = { | ||
val query = Uri.Query("key" -> key) | ||
Uri(host.resolve(path).toString) | ||
.withQuery(query) | ||
.toString | ||
} | ||
} | ||
|
||
object AviationConfig { | ||
def load: AviationConfig = ConfigSource.default.at("aviation").loadOrThrow[AviationConfig] | ||
} | ||
|
||
final case class OpenSkyConfig( | ||
host: URI, | ||
apiTimeout: Int, | ||
tickSource: TickSourceConfig, | ||
flightStateStream: ApiProviderStreamConfig | ||
) { | ||
def getOpenSkyUri(path: String): String = | ||
host.resolve(path).toString | ||
} | ||
|
||
object OpenSkyConfig { | ||
def load: OpenSkyConfig = ConfigSource.default.at("opensky").loadOrThrow[OpenSkyConfig] | ||
} | ||
|
||
final case class ApiProviderStreamConfig( | ||
path: String, | ||
pollingStart: Int, | ||
pollingInterval: Int | ||
) | ||
|
||
final case class TickSourceConfig(pollLowerHourLimit: Int, pollUpperHourLimit: Int, pollExcludedDays: List[DayOfWeek]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
src/main/scala/it/bitrock/dvs/producer/aviationedge/config/AviationConfig.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.