Using vCenter Orchestrator with RabbitMQ and vCloud Director – Part 3

Overview

In this post we are going to use vCO to create a RabbitMQ broker, exchange and a queue.  We will then bind to the queue so that we can send messages to the queue and retrieve them.

Adding a Broker

In the vCO client go to the workflow tab and then Library > AMQP.  Right-click the Add a broker workflow and set select Start Workflow. Give the broker a name and select Next.

2014-10-08_20-58-42

Fill in the RabbitMQ host, leave the virtual host as / unless you want to change it and know what you’re doing.  The credentials are guest / guest.

2014-10-08_20-59-25

If the workflow is successful, you will see:

2014-10-08_20-59-55

Declaring an Exchange

In the vCO client go to the workflow tab and then Library > AMQP.  Right-click on Declare an exchange and select Start Workflow.

  1. Select Not Set and browse to your broker
  2. Expand AMQP and select your broker
  3. Select Select

2014-10-08_21-08-52

Press Next and enter the following:

2014-10-21_20-05-33

Press Submit and if it completes successfully, you’ll see a green check.

2014-10-08_21-13-17

If you go to your RabbitMQ web interface, you’ll see the exchange we just created:

2014-10-08_21-15-17

Declaring a Queue

In the vCO client go to the workflow tab and then go to Library > AMQP.  Right-click on Declare a queue and select Start Workflow.

Select your broker as before:

2014-10-08_21-17-49

Fill in the following info:

2014-10-08_21-18-18

Select Submit and you should get a green check if the workflow completes successfully.

In the RabbitMQ web interface we can see the new queue:

2014-10-08_21-20-18

Binding to the Queue

In the vCO client go to the workflow tab and then go to Library > AMQP.  Right-click on Bind and select Start Workflow.

Select your broker and select Next:

2014-10-08_21-17-49

Fill in the following and press Submit.

2014-10-08_21-52-47

The routing key is “true.*.*.*.com.vmware.vcloud.event.blockingtask.create.vappDeploy”.  See Notification Message Format for more information on this. Once we have blocking tasks in vCloud set up, every time a vApp is deployed, a blocking task will go into this queue.  Now if we click on the queue in the RabbitMQ web interface, we will see the new binding:

2014-10-08_21-53-43

Sending a message to the queue

In the vCO client go to the workflow tab and then go to Library > AMQP.  Right-click on Send a text message and select Start Workflow.

Select your broker and select Next:

2014-10-08_21-17-49

Fill in the following and select Next:

2014-10-08_21-54-30

Type in a message and select Submit.  Sometimes here Submit isn’t highlighted so you have to press Back then Submit

2014-10-08_21-35-04

Back in the RabbitMQ web interface we see that a new message has arrived:

2014-10-08_21-35-48

We can also scroll down to the Get messages section and press Get Messages.

2014-10-08_21-55-24

Here we can see our message.  Set Requeue to No so that the message is removed off of the queue.

vCloud Director Configuration

Let’s do something a little more interesting and configure vCloud Director (vCD) to send messages to RabbitMQ when a vApp is deployed.  From the vCD portal, enter the following:

2014-10-08_21-39-12

Configure the blocking task:

  1. Select the Administration menu item
  2. Select Extensibility
  3. Check Start vApp (Deploy from API)
  4. Press Apply

2014-10-08_21-41-57

Go ahead and start any vApp.  You’ll see the status change to Pending processing…

2014-10-08_21-46-35

This time the payload has a lot of vCD related information such as the ids for the org, user, etc of the vApp that was attempted to be deployed:

2014-10-08_22-30-15

You could work with this data in the current format, but it’s much easier to use the vCD Notification Package.  This package will extract all the details from the blocking task and populate variables such as user, org, org vDC, etc.  It also allows you to run vCO workflows where you can use the data that was extracted out of the blocking task to do whatever you want.  For example, you could add the deployed system to a CMDB, call out to Infoblox to update the DNS, etc.  You probably want to use a different blocking task (vApp creation) type for this however.  There are two different types for creating vApps.  I’ll cover the vCD Notification Package and creating RabbitMQ subscriptions from vCO in the next post.

 

 

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s