Finally, we going to connect to our ESB using JMX and examine what is happening under the covers
JMX
When ServiceMix is running, you can connect to it using a JMX console to examine what is going on inside ServiceMix and to manage the environment. Usually, if you have installed a recent JDK, you should have a JMX console available in your JDK's bin directory (jconsole).
Connection and overview
If you start this program, you get a screen to create a new connection. Although you can also connect to ServiceMix from another machine, we are going to assume that ServiceMix is running locally, so we can connect to a local process. The process you're looking for is called org.codehaus.classworlds.Launcher
Once connected, you get an overview screen, showing you information about threads, memory usage, ...
MBeans
More interesting is the MBean screen. If you switch over to that screen, you will find a tree navigator on the right hand side. Navigate this tree to find the ServiceMix-related information. In the list of topics under ServiceMix, you find a lot of the concepts that have been introduced in this tutorial: Component, JBIContainer, Service Assembly and Service Unit.
Remember how we installed two components in our JBI container, servicemix-http to provide the HTTP transport and servicemix-jsr181 to build web services? You can find out which components have been installed by navigating the tree to the Component level.
Very similarly, you can also take a look at the service assemblies that have been deployed. Try to find the wsdl-first-sa service assembly we deployed earlier in your console. If you look carefully, you also see that you can invoke operations from this console. It is possible to start and stop a service assembly using the JMX console.
Just to try this out, click the stop() button here. You get a window showing you the result of your action after it has completed. You can also see what happened in the ServiceMix console:
Now, click the start() button to restart the service assembly. Check it everything was OK at the console:
Endpoints
When we deployed our service assembly, we provided our ESB with the necessary configuration information to create some new services. Services are available through endpoints and JBI distinguishes between two different kinds of endpoints:
- internal endpoints make a service available through the ESB
in our example, there is a JSR-181 POJO living in the servicemix-jsr181 component which is available through the ESB
- external endpoints are used to expose an internal endpoint to the outside world
in our example, our POJO is exposed to the outside world using HTTP (remember how we tested the example with our web browser?)
Things to remember
- You can connect to ServiceMix using JMX to look inside the ESB (components, endpoints, ...) and to manage the environment.
- Services are exposed to the ESB using internal endpoints.
- External endpoints expose a service to the outside world.
Further reading