Skip to content

Commit

Permalink
fix(keiko): register message types so queue can work
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Sep 20, 2018
1 parent 0bc7f89 commit 8dc2c29
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/
package com.netflix.spinnaker.keel

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.keel.persistence.AssetRepository
import com.netflix.spinnaker.keel.processing.ConvergeAsset
import com.netflix.spinnaker.keel.processing.ValidateAssetTree
import com.netflix.spinnaker.keel.registry.PluginRepository
import com.netflix.spinnaker.kork.PlatformComponents
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -54,11 +57,26 @@ class RuleEngineApp {
@Autowired
lateinit var assetRepository: AssetRepository

@Autowired
lateinit var objectMapper: ObjectMapper

@PostConstruct
fun initialStatus() {
log.info("Using {} plugin repository implementation", pluginRepository.javaClass.simpleName)
log.info("Using {} asset repository implementation", assetRepository.javaClass.simpleName)
}

@PostConstruct
fun registerKeikoMessageTypes() {
val messageTypes = arrayOf(
ValidateAssetTree::class.java,
ConvergeAsset::class.java
)
messageTypes.forEach {
log.info("Registering message type {} on {}", it.simpleName, objectMapper)
}
objectMapper.registerSubtypes(*messageTypes)
}
}

fun main(vararg args: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
*/
package com.netflix.spinnaker.keel.processing

import com.fasterxml.jackson.annotation.JsonTypeName
import com.netflix.spinnaker.keel.model.AssetId
import com.netflix.spinnaker.q.Message

@JsonTypeName("ValidateAssetTree")
data class ValidateAssetTree(
val rootId: AssetId
) : Message()

@JsonTypeName("ConvergeAsset")
data class ConvergeAsset(
val id: AssetId
) : Message()

0 comments on commit 8dc2c29

Please sign in to comment.