tomcatakkasprayspray-routing

Dead Letter Arriving When Spray-Servlet Loads


I'm working with spray-servlet (using Tomcat 8 as the servlet container) and spray-routing.

Whenever I deploy my WAR, my serviceActor receives a message. This message goes to a specific path and it's always the same path and always once. The sender is the system's dead letters actor.

I am not sure where this message is coming from. Would appreciate any help debugging this issue.


Solution

  • As is mostly the case, the issue was user error.

    My routes were defined like this:

    ... {
        doStuff()
        complete(OK)
    }
    

    Causing the loading phase of spray-routing to execute the code before stopping at complete.

    I changed my code to look like this:

    ... {
        complete {
            doStuff()
            OK
        }
    }
    

    And everything's working as it should.