diff options
author | 2019-02-27 23:31:15 +0100 | |
---|---|---|
committer | 2019-03-11 12:43:48 +0100 | |
commit | e9220923d2a13fa787f2f2f7b8bedc60cc9b2324 (patch) | |
tree | 9d8b4e9a5ec6da712a2d76b6897c9f66e79e2c44 /sources/hv-collector-core/src/main/kotlin | |
parent | f938e8a87a33f8db78115a92f5130d6296171c62 (diff) |
Added JSON config file format utils
Change-Id: I97fdd72324495b4c838e44c306cbcacac6b11bc1
Signed-off-by: Pawel Biniek <pawel.biniek@nokia.com>
Issue-ID: DCAEGEN2-1323
Diffstat (limited to 'sources/hv-collector-core/src/main/kotlin')
-rw-r--r-- | sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt index ad97a3f7..dc7db5a2 100644 --- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt +++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt @@ -29,7 +29,7 @@ data class Routing(val routes: List<Route>) { Option.fromNullable(routes.find { it.applies(commonHeader) }) } -data class Route(val domain: String, val targetTopic: String, val partitioning: (CommonEventHeader) -> Int) { +data class Route(val domain: String, val targetTopic: String, val partitioning: (CommonEventHeader) -> Int = {0}) { fun applies(commonHeader: CommonEventHeader) = commonHeader.domain == domain @@ -67,15 +67,15 @@ class RouteBuilder { private lateinit var targetTopic: String private lateinit var partitioning: (CommonEventHeader) -> Int - fun fromDomain(domain: String) { + fun fromDomain(domain: String) : RouteBuilder = apply { this.domain = domain } - fun toTopic(targetTopic: String) { + fun toTopic(targetTopic: String) : RouteBuilder = apply { this.targetTopic = targetTopic } - fun withFixedPartitioning(num: Int = 0) { + fun withFixedPartitioning(num: Int = 0) : RouteBuilder = apply { partitioning = { num } } |