DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. JMS Mbean Configuration in Spring Integration

JMS Mbean Configuration in Spring Integration

Krishna Prasad user avatar by
Krishna Prasad
·
Dec. 16, 12 · Interview
Like (0)
Save
Tweet
Share
6.41K Views

Join the DZone community and get the full member experience.

Join For Free
spring integration jms message-driven-channel-adapter has good mbean support through defaultmessagelistenercontainer where we can control the flow of messages to the subscribers. in this blog i will demonstrate some of these capabilities. for people in hurry, here is the code @ github,

  • download activemq and unzip it
  • run activemq.bat under <activemq-home>/bin folder
  • go to browser and type http://localhost:8161/admin/queues.jsp , create a new queue “myqueue”
  • get the latest code from github
  • build the war file using “mvn clean package”
  • deploy the war file in spring tomcat container
  • “send to” message to myqueue in admin console of activemq in the browser
  • you notice the message gets consumed
  • open jconsole.exe under jdk bin directory
  • login in to remote process “localhost:6969″, uid: admin, password: “springsource”
  • go to mbean tab and expand spring.application/jmscontainer/testqueuecontainer/operation, click on stop operation
  • again “send to” message to myqueue in admin console of activemq in the browser, if you notice, the message is not consumed
  • go to mbean tab and expand spring.application/jmscontainer/testqueuecontainer/operation, click on start operation
  • again “send to” message to myqueue in admin console of activemq in the browser, if you notice, the message got consumed

details: spring integration jms mbean configuration

in a typical enterprise it production environment, you need to control the message processing by the queue subscribers. a typical scenario would be, if there is a an issue with the subscriber and we want to pause the subscriber to troubleshoot it, we need a mechanism for this as below.

expose lifecycle interface of defaultmessagelistenercontainer

<bean id="queue.exporter" class="org.springframework.jmx.export.mbeanexporter">
<property name="beans">
<map>
<entry key="spring.application:type=jmscontainer,name=testqueuecontainer" value-ref="queuecontainer" />
</map>
</property>
<property name="assembler">
<bean class="org.springframework.jmx.export.assembler.interfacebasedmbeaninfoassembler">
<property name="managedinterfaces">
<value>org.springframework.context.lifecycle</value>
</property>
</bean>
</property>
</bean>

interfacebasedmbeaninfoassembler class expose an interface of a particular class as a mbean, in the above example it exposes lifecycle

managing jms subscriber in jconsole

managing jms subscriber using jconsole

managing jms subscriber using jconsole

when you click on start operation, and click on start button, it will start the subscriber to listen to the message and when you click on stop, it will pause the subscriber.

conclusion

mbean is a powerful way to expose some of the capabilities of spring integration’s various channel adapter, so that you can control them from various tools which are mbean aware, like jconsole, hyperic . we can also expose, log4j mbean so that we can change the log level in the production system. more on this in my subsequent blog.



Spring Integration Spring Framework Integration

Published at DZone with permission of Krishna Prasad, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • DZone's Article Submission Guidelines
  • How to Submit a Post to DZone
  • Top Three Docker Alternatives To Consider
  • How To Create and Edit Excel XLSX Documents in Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: