|
| 1 | +<?xml version='1.0' encoding='utf-8' ?> |
| 2 | +<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
| 3 | +<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent"> |
| 4 | +%BOOK_ENTITIES; |
| 5 | +]> |
| 6 | + |
| 7 | +<!-- Licensed to the Apache Software Foundation (ASF) under one |
| 8 | + or more contributor license agreements. See the NOTICE file |
| 9 | + distributed with this work for additional information |
| 10 | + regarding copyright ownership. The ASF licenses this file |
| 11 | + to you under the Apache License, Version 2.0 (the |
| 12 | + "License"); you may not use this file except in compliance |
| 13 | + with the License. You may obtain a copy of the License at |
| 14 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | + Unless required by applicable law or agreed to in writing, |
| 16 | + software distributed under the License is distributed on an |
| 17 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 18 | + KIND, either express or implied. See the License for the |
| 19 | + specific language governing permissions and limitations |
| 20 | + under the License. |
| 21 | +--> |
| 22 | +<section id="event-framework"> |
| 23 | + <title>Event Notification</title> |
| 24 | + <para>Event notification framework provides a means for the Management Server components to |
| 25 | + publish and subscribe to &PRODUCT; events. Event notification is achieved by implementing the |
| 26 | + concept of event bus abstraction in the Management Server. An event bus is introduced in the |
| 27 | + Management Server that allows the &PRODUCT;components and extension plug-ins to subscribe to the |
| 28 | + events by using the Advanced Message Queuing Protocol (AMQP) client. In &PRODUCT;, a default |
| 29 | + implementation of event bus is provided as a plug-in that uses the RabbitMQ AMQP client. The |
| 30 | + AMQP client pushes the published events to a compatible AMQP server. Therefore all the &PRODUCT; |
| 31 | + events are published to an exchange in the AMQP server. </para> |
| 32 | + <para>A new event for state change, resource state change, is introduced as part of Event |
| 33 | + notification framework. Every resource, such as user VM, volume, NIC, network, public IP, |
| 34 | + snapshot, and template, is associated with a state machine and generates events as part of the |
| 35 | + state change. That implies that a change in the state of a resource results in a state change |
| 36 | + event, and the event is published in the corresponding state machine on the event bus. All the |
| 37 | + &PRODUCT; events (alerts, action events, usage events) and the additional category of resource |
| 38 | + state change events, are published on to the events bus.</para> |
| 39 | + <formalpara> |
| 40 | + <title>Use Cases</title> |
| 41 | + <para>The following are some of the use cases:</para> |
| 42 | + </formalpara> |
| 43 | + <itemizedlist> |
| 44 | + <listitem> |
| 45 | + <para>Usage or Billing Engines: A third-party cloud usage solution can implement a plug-in |
| 46 | + that can connects to &PRODUCT; to subscribe to &PRODUCT; events and generate usage data. The |
| 47 | + usage data is consumed by their usage software.</para> |
| 48 | + </listitem> |
| 49 | + <listitem> |
| 50 | + <para>AMQP plug-in can place all the events on the a message queue, then a AMQP message broker |
| 51 | + can provide topic-based notification to the subscribers.</para> |
| 52 | + </listitem> |
| 53 | + <listitem> |
| 54 | + <para>Publish and Subscribe notification service can be implemented as a pluggable service in |
| 55 | + &PRODUCT; that can provide rich set of APIs for event notification, such as topics-based |
| 56 | + subscription and notification. Additionally, the pluggable service can deal with |
| 57 | + multi-tenancy, authentication, and authorization issues.</para> |
| 58 | + </listitem> |
| 59 | + </itemizedlist> |
| 60 | + <formalpara> |
| 61 | + <title>Configuration</title> |
| 62 | + <para>As a &PRODUCT; administrator, perform the following one-time configuration to enable event |
| 63 | + notification framework. At run time no changes can control the behaviour.</para> |
| 64 | + </formalpara> |
| 65 | + <orderedlist> |
| 66 | + <listitem> |
| 67 | + <para>Open <filename>'componentContext.xml</filename>.</para> |
| 68 | + </listitem> |
| 69 | + <listitem> |
| 70 | + <para>Define a bean named <filename>eventNotificationBus</filename> as follows:</para> |
| 71 | + <itemizedlist> |
| 72 | + <listitem> |
| 73 | + <para>name : Specify a name for the bean.</para> |
| 74 | + </listitem> |
| 75 | + <listitem> |
| 76 | + <para>server : The name or the IP address of the RabbitMQ AMQP server.</para> |
| 77 | + </listitem> |
| 78 | + <listitem> |
| 79 | + <para>port : The port on which RabbitMQ server is running.</para> |
| 80 | + </listitem> |
| 81 | + <listitem> |
| 82 | + <para>username : The username associated with the account to access the RabbitMQ |
| 83 | + server.</para> |
| 84 | + </listitem> |
| 85 | + <listitem> |
| 86 | + <para>password : The password associated with the username of the account to access the |
| 87 | + RabbitMQ server.</para> |
| 88 | + </listitem> |
| 89 | + <listitem> |
| 90 | + <para>exchange : The exchange name on the RabbitMQ server where &PRODUCT; events are |
| 91 | + published.</para> |
| 92 | + <para>A sample bean is given below:</para> |
| 93 | + <programlisting><bean id="eventNotificationBus" class="org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus"> |
| 94 | + <property name="name" value="eventNotificationBus"/> |
| 95 | + <property name="server" value="127.0.0.1"/> |
| 96 | + <property name="port" value="5672"/> |
| 97 | + <property name="username" value="guest"/> |
| 98 | + <property name="password" value="guest"/> |
| 99 | + <property name="exchange" value="cloudstack-events"/> |
| 100 | + </bean></programlisting> |
| 101 | + <para>The <filename>eventNotificationBus</filename> bean represents the |
| 102 | + <filename>org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus</filename> class.</para> |
| 103 | + </listitem> |
| 104 | + </itemizedlist> |
| 105 | + </listitem> |
| 106 | + <listitem> |
| 107 | + <para>Restart the Management Server.</para> |
| 108 | + </listitem> |
| 109 | + </orderedlist> |
| 110 | +</section> |
0 commit comments