Skip to content

Commit

Permalink
fix(q): actually using dead letter handler (spinnaker#2166)
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns authored Apr 19, 2018
1 parent 71d9216 commit f0c27f2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ junitVersion=1.0.2
jupiterVersion=5.0.2
junitLegacyVersion=4.12.0
spekVersion=1.1.5
keikoVersion=2.6.1
keikoVersion=2.7.0
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class RedisQueueShovelConfiguration {
queueName = redisQueueProperties.queueName,
pool = redisPool,
clock = clock,
deadMessageHandler = deadMessageHandler,
deadMessageHandlers = listOf(deadMessageHandler),
publisher = publisher,
ackTimeout = Duration.ofSeconds(redisQueueProperties.ackTimeoutSeconds.toLong()),
mapper = redisQueueObjectMapper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ class TestConfig {
) =
InMemoryQueue(
clock = clock,
deadMessageHandler = deadMessageHandler,
deadMessageHandlers = listOf(deadMessageHandler),
publisher = publisher
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ import com.netflix.spinnaker.orca.q.ExecutionLevel
import com.netflix.spinnaker.orca.q.StageLevel
import com.netflix.spinnaker.orca.q.TaskLevel
import com.netflix.spinnaker.q.Attribute
import com.netflix.spinnaker.q.DeadMessageCallback
import com.netflix.spinnaker.q.Message
import com.netflix.spinnaker.q.Queue
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Component

@Component class DeadMessageHandler {
@Component class DeadMessageHandler : DeadMessageCallback {
private val log = LoggerFactory.getLogger(javaClass)

fun handle(queue: Queue, message: Message) {
override fun invoke(queue: Queue, message: Message) {
log.error("Dead message: $message")
terminationMessageFor(message)
?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object DeadMessageHandlerTest : SubjectSpek<DeadMessageHandler>({
afterGroup(::resetMocks)

on("receiving a message") {
subject.handle(queue, message)
subject.invoke(queue, message)
}

it("terminates the execution") {
Expand All @@ -60,7 +60,7 @@ object DeadMessageHandlerTest : SubjectSpek<DeadMessageHandler>({
afterGroup(::resetMocks)

on("receiving a message") {
subject.handle(queue, message)
subject.invoke(queue, message)
}

it("aborts the stage") {
Expand All @@ -74,7 +74,7 @@ object DeadMessageHandlerTest : SubjectSpek<DeadMessageHandler>({
afterGroup(::resetMocks)

on("receiving a message") {
subject.handle(queue, message)
subject.invoke(queue, message)
}

it("terminates the task") {
Expand All @@ -90,7 +90,7 @@ object DeadMessageHandlerTest : SubjectSpek<DeadMessageHandler>({
afterGroup(::resetMocks)

on("receiving a message") {
subject.handle(queue, message)
subject.invoke(queue, message)
}

it("does nothing") {
Expand Down

0 comments on commit f0c27f2

Please sign in to comment.