Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Commit

Permalink
config(kotlin): make QueueProcessor and RedisQueue open (#36)
Browse files Browse the repository at this point in the history
The kotlin-spring plugin only applies all-open to classes that have Spring
annotations, but QueueProcessor and RedisQueue are not explicitly annotated.

Let's add a new annotation, KotlinOpen and configure the all-open plugin
to look for classes annotated with it.
  • Loading branch information
dreynaud authored May 15, 2018
1 parent 10f01b4 commit c41e00d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gradle/kotlin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

apply plugin: "nebula.kotlin"
apply plugin: "kotlin-spring"
apply plugin: "kotlin-allopen"

allOpen {
annotation("com.netflix.spinnaker.KotlinOpen")
}

configurations.all {
resolutionStrategy {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.netflix.spinnaker

annotation class KotlinOpen
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.q

import com.netflix.spinnaker.KotlinOpen
import com.netflix.spinnaker.q.metrics.EventPublisher
import com.netflix.spinnaker.q.metrics.MessageDead
import com.netflix.spinnaker.q.metrics.HandlerThrewError
Expand All @@ -32,6 +33,7 @@ import javax.annotation.PostConstruct
* The processor that fetches messages from the [Queue] and hands them off to
* the appropriate [MessageHandler].
*/
@KotlinOpen
class QueueProcessor(
private val queue: Queue,
private val executor: QueueExecutor<*>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.netflix.spinnaker.q.redis
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.google.common.hash.Hashing
import com.netflix.spinnaker.KotlinOpen
import com.netflix.spinnaker.q.AttemptsAttribute
import com.netflix.spinnaker.q.DeadMessageCallback
import com.netflix.spinnaker.q.MaxAttemptsAttribute
Expand Down Expand Up @@ -47,6 +48,7 @@ import java.time.Instant
import java.time.temporal.TemporalAmount
import java.util.*

@KotlinOpen
class RedisQueue(
private val queueName: String,
private val pool: Pool<Jedis>,
Expand Down

0 comments on commit c41e00d

Please sign in to comment.