puppetlabs/marionette-collective — pull request #172 by richardc (2014-03-12 19:41:41+00:00)
Title: (MCO-192) Implement back-off at the connector level

This commit adds higher level for exponential backoff to the
connectors. The STOMP gem's support for exponential backoff only
handles tcp-level failures. Here we allow for protocol-level
issues such as incorrect credentials causing a disconnection.

In order to do that we add a new execption class, BackoffSuggestion,
and two specific exception classes derived from it that allow the
code that raises the error to make a suggestion about how long the
handler should wait before proceeding. These two classes are
MessageNotReceived for when the connector is unable to receive a
message, and UnexpectedMessageType for when a message isn't of the
kind you were expecting. For STOMP these map to connector.receive
== nil and msg.command != 'MESSAGE' respectively.

As part of this change to the flow we refactor the tests heavily to allow for
pluginconfig to be resolved in the initializer of the connector, as we use the
existing stomp gem keepalive settings for our own connector-level
`exponential_back_off` method.