...
The Virtual Human Messaging library (VHMSGVHMsg) defines a protocol and provides an API wrapper around ActiveMQ. It's intended to provide an easy solution for sending and receiving messages within the Virtual Human Architecture. It supports the following programming languages:
- C/C++
- C#
- Java
- TCL
- Lisp
In order for components to send or receive messages with each other, they need to:
- be connected to the same ActiveMQ server, which is a Windows service that needs to be running
- be operating within the same scope on that server
The VHMSG VHMsg library will set sets the default server to 'localhost' and scope to 'DEFAULT_SCOPE'. If you installed all 3rd party software and are running the toolkit on your local machine, there should be nothing you need to do in order for everything to work. If you want to run a distributed system on several machines simultaneously, all the machines need to point to the same ActiveMQ server (say e.g., 'vh1.ict.usc.edu') and the same scope (say e.g., 'TOOLKIT_SCOPE'). You can To do this by creating , create two environment variables, see below.
Messages are being broadcasted, meaning there is no specific destination. As a component, you need to subscribe to the messages you want to receive. For an overview of the most common messages, see the Messaging section.
When creating new modules, be sure to implement the messaging protocol as defined here. This ensures components are aware of each other's existence and that they behave correctly.
Users
...
Changing the ActiveMQ server or scope
You can change Change these by creating VHMSG_SERVER and VHMSG_SCOPE environment variables.
...
Checking ActiveMQ server and scope
...
This is found in the top right corner of the Logger, or in the Launcher after going to the Advanced menu and clicking on Show Information, at the bottom.
Developers
...
Implementing and using VHMsg in C++
Our C++ implementation is built on top of the C++ ActiveMQ libraries called CMS (http://activemq.apache.org/cms/). Headers and libraries are provided for Visual Studio. VS2010 is the currently maintained version.
There are two implementations that can be used for C++. The simplest implementation is based off the header found in \lib\vhmsg\vhmsg-c\include\vhmsg-tt.h and will be described below.
A sample using this implementation is included in \lib\vhmsg\samples\elbench\cpp\elbench.cpp. A condensed version of this sample is shown to give you an idea of what's required:
...
There are a number of Include directories and Libraries that need to be set up in order for this sample to compile and link properly. Also, note the .dlls that are required to be alongside the executable at runtime. Please see the Visual Studio solution provided in the elbench sample to see what's required. The required .dlls are copied in the Post-Build step.
Be sure to implement the messaging protocol as defined here.
...
Implementing and using VHMsg in C#
Our C# implementation is built on top of the C# ActiveMQ libraries called NMS (http://activemq.apache.org/nms/).
A elbench sample is included in \lib\vhmsg\samples\elbench\cs\elbench.cs. A condensed version of the sample is shown to give you an idea of what's required:
...
This example uses the 'immediate' method for retreiving retrieving messages. Note that it doesn't poll from messages, and messages are received on a different thread. Please be careful when handling these messages.
A 'polling' method is available to simplify handling of the messages, if desired. Please see EnablePollingMethod() and Poll() in the VHMSG VHMsg documentation. \lib\vhmsg\vhmsg-net\doc\vhmsg-net.chm.
In order to To use this library, you need to compile with the ActiveMQ NMS libraries. See the Visual Studio project settings in the elbench sample for how to do this.
Be sure to implement the messaging protocol as defined here.
...
Implementing and using VHMsg in Java
Our Java implementation is built on top of the Java ActiveMQ libraries (http://activemq.apache.org).
...
This example uses the 'immediate' method for retreiving retrieving messages. Note that it doesn't poll from messages, and messages are received on a different thread. Please be careful when handling these messages.
A 'polling' method is available to simplify handling of the messages. Please see EnablePollingMethod() and Poll() in the VHMSG VHMsg documentation. lib\vhmsg\samples\elbench\java\dist\javadoc\index.html.
In order to To use this library, you need to add vhmsg-java.jar to your project. See the Netbeans project settings in the elbench sample for how to do this.
...