Spring Integration - Monitoring
This application demonstrates managing and monitoring Spring Integration Applications.
It is based on the STS 'Spring Integration Project (war)' template project, available using
New... | Spring Template Project
It was used in the Managing and Monitoring Spring Integration webinar available on the SpringSource Developer YouTube Channel.
If you wish to see the changes made during the webinar, please use the following git command:
git log -p <The commit titled 'Webinar End State'>
To run the sample, in STS, use:
Run As... | Run on Server
and then use VisualVM/JConsole to explore the MBeans.
The twitter search results can be examined at http://localhost:8080/monitoring.
2.2 Updates:
The application context now includes an example of <int-jmx:notification-publishing-channel-adapter/>, to which the tweets are published. You can navigate to the MBean - spring.application:type=TweetPublisher,name=tweeter, click the Notifications tab and then subscribe. You will then see the notifications.
An additional class NotificationListener is now included. It demonstrates the use of <int-jmx:notification-listening-channel-adapter> and <int-jmx:attribute-polling-channel-adapter>.
Also, it shows how to use an <int-jmx:operation-invoking-channel-adapter> to stop/start the dummyAdapter in the web application.
These adapters use a client connector to connect to the Twitter search web application to catch notifications published by it, polls the sendCount attribute of the twitterChannel. and invokes operations on the dummyAdapter.
You will need to update the credentials on the clientConnector in remote-monitor-context.xml to match your environment. If you are using STS, you can find the credentials in Servers | [server] | jmxremote.password. You can then run the NotificationListener's main method.
You should observe log output of the notifications as well as polling the channel's sendCount. Simply use the console to enter 'n' to stop and 'y' to start the adapter.
These changes show how you can create a sophisticated monitoring application using Spring Integration - it is important to understand that the application being monitored doesn't have to be a Spring or Spring Integration application - any application that exports MBeans can be monitored in this way.
For help please see the Spring Integration documentation: