Hi,

We have a scala based RoutePolicy implementation

--
@ManagedResource(description = "Ensures that the specified dependent route
is started")
case class EnsureRouteStarted(id: String) extends RoutePolicySupport {

  @ManagedAttribute(description = "The dependent route to be started")
  def getDependentRouteId: String = id

  override def onExchangeBegin(route: Route, exchange: Exchange): Unit = {
    val context: CamelContext = route.getRouteContext.getCamelContext

    try {
      context.getRouteStatus(id) match {
        case ServiceStatus.Starting => ;
        case ServiceStatus.Started => ;
        case ServiceStatus.Stopping => context.startRoute(id)
        case ServiceStatus.Stopped => context.startRoute(id)
        case ServiceStatus.Suspending => context.resumeRoute(id)
        case ServiceStatus.Suspended => context.resumeRoute(id)
      }
    }
    catch {
      case e: Exception ⇒ {
        throw new RuntimeCamelException(s"Failed to ensure route <$id>
started", e)
      }
    }
  }

  override def toString: String = s"EnsureRouteStarted($id)"
}
--

which is intended to start a required route if it is not active ( we also
have an IdleRoutePolicy that stops routes when no message has been received
within a given timeframe ), the usage for the above policy is

--

from("uri")
.routePolicy(EnsureRouteStarted("target-id"))
.to("direct:target-uri")

from("direct:target-uri").id("target-id")...

--

This was working fine under 2.14.1 however a recent upgrade to 2.15.1 has
caused it to start occasionally failing in production, unit and integration
testing all pass succesfully however.

What happens now is that on occasion the route will begin retrying and
throwing `DirectConsumerNotAvailableException` exceptions when it reaches
the .to("direct:target-uri"). Starting the "direct:target-uri" route using
JMX will fix the issue and it then continues happily until it next
reappears.

The only conclusion that can be drawn at present is that the route policy is
not being run during the retry - however as noted this clearly performs as
expected during testing.

Any thoughts on what might be the cause welcome,

Cheers.

Bob

 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Missing-RoutePolicy-with-Redelivery-tp5772995.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to