You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2012/04/09 21:27:35 UTC

svn commit: r1311387 - /activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala

Author: chirino
Date: Mon Apr  9 19:27:35 2012
New Revision: 1311387

URL: http://svn.apache.org/viewvc?rev=1311387&view=rev
Log:
Don't try to use the advisory topic until the virtual host starts up.

Modified:
    activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala?rev=1311387&r1=1311386&r2=1311387&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala Mon Apr  9 19:27:35 2012
@@ -17,7 +17,6 @@
 package org.apache.activemq.apollo.openwire
 
 import command._
-import org.apache.activemq.apollo.dto.DestinationDTO
 import org.apache.activemq.apollo.broker.security.SecurityContext
 import collection.mutable.HashMap
 import DestinationConverter._
@@ -177,22 +176,23 @@ class DestinationAdvisoryRouterListener(
     val message = delivery.message.asInstanceOf[OpenwireMessage].message
     val dest = to_destination_dto(message.getDestination,null)
     val key = dest.toList
+    if( router.virtual_host.service_state.is_started ) {
+      val route = producerRoutes.get(key) match {
+        case null =>
+          // create the producer route...
+          val route = new ProducerRoute
+          producerRoutes.put(key, route)
+          val rc = router.connect(dest, route, null)
+          rc match {
+            case Some(failure) => warn("Could not connect to advisory topic '%s' due to: %s", message.getDestination, failure)
+            case None =>
+          }
+          route
 
-    val route = producerRoutes.get(key) match {
-      case null =>
-        // create the producer route...
-        val route = new ProducerRoute
-        producerRoutes.put(key, route)
-        val rc = router.connect(dest, route, null)
-        rc match {
-          case Some(failure) => warn("Could not connect to advisory topic: " + message.getDestination)
-          case None =>
-        }
-        route
-
-      case route => route
+        case route => route
+      }
+      route.overflow_sink.offer(delivery)
     }
-    route.overflow_sink.offer(delivery)
   }
 
 }