Merge branch '4.9'

This commit is contained in:
Rohit Yadav 2016-11-03 16:52:34 +05:30
commit 41c71576c0
No known key found for this signature in database
GPG Key ID: 484248210EE3D884
2 changed files with 20 additions and 8 deletions

View File

@ -81,6 +81,17 @@
<artifactId>cloud-framework-events</artifactId> <artifactId>cloud-framework-events</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.apache.cloudstack</groupId> <groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-framework-spring-lifecycle</artifactId> <artifactId>cloud-framework-spring-lifecycle</artifactId>

View File

@ -28,8 +28,8 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.events.EventBus;
import org.apache.cloudstack.framework.messagebus.MessageBusBase; import org.apache.cloudstack.framework.events.EventBusException;
import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
@ -46,7 +46,7 @@ import com.cloud.utils.component.ComponentMethodInterceptor;
public class EventUtils { public class EventUtils {
private static final Logger s_logger = Logger.getLogger(EventUtils.class); private static final Logger s_logger = Logger.getLogger(EventUtils.class);
protected static MessageBus s_messageBus = null; protected static EventBus s_eventBus = null;
public EventUtils() { public EventUtils() {
} }
@ -58,9 +58,9 @@ public class EventUtils {
} }
try { try {
s_messageBus = ComponentContext.getComponent(MessageBusBase.class); s_eventBus = ComponentContext.getComponent(EventBus.class);
} catch (NoSuchBeanDefinitionException nbe) { } catch (NoSuchBeanDefinitionException nbe) {
return; // no provider is configured to provide events bus, so just return return; // no provider is configured to provide events bus, so just return
} }
org.apache.cloudstack.framework.events.Event event = org.apache.cloudstack.framework.events.Event event =
@ -72,9 +72,10 @@ public class EventUtils {
eventDescription.put("details", details); eventDescription.put("details", details);
event.setDescription(eventDescription); event.setDescription(eventDescription);
try { try {
s_messageBus.publish(EventTypes.getEntityForEvent(eventType), eventType, null, event); s_eventBus.publish(event);
} catch (Exception e) { } catch (EventBusException evx) {
s_logger.warn("Failed to publish action event on the the event bus."); String errMsg = "Failed to publish contrail event.";
s_logger.warn(errMsg, evx);
} }
} }