First I know that the questions below has been asked many times.  I have seen 
several posts where the replies say: "Search for the Answer".  I have searched 
and I can't find it... 

Problem:
I have a queue and a listener.  The listener is configured as an MDB.  I want 
to be able to:

o Start/Stop the Queue via JMX
o Start/Stop the Queue progrmatically


I cannot find an answer for either.  First the JMX issue

Environment:
JBoss: Jboss-5.0.0 GA
JDK:    jdk1.6.0_10

Below is the code for my MDB:
import javax.ejb.ActivationConfigProperty;
  | import javax.ejb.MessageDriven;
  | import javax.jms.JMSException;
  | import javax.jms.Message;
  | import javax.jms.MessageListener;
  | import javax.jms.TextMessage;
  | 
  | @MessageDriven(mappedName = "jms/SSMListener", activationConfig = {
  |             @ActivationConfigProperty(propertyName="messagingType", 
propertyValue="javax.jms.MessageListener"),
  |             @ActivationConfigProperty(propertyName = "acknowledgeMode", 
propertyValue = "Auto-acknowledge"),
  |             @ActivationConfigProperty(propertyName = "destinationType", 
propertyValue = "javax.jms.Queue"),
  |             
@ActivationConfigProperty(propertyName="destination",propertyValue="queue/SSMQueue")
 })
  | public class SSMListener implements MessageListener {
  | 
  |     public void onMessage(Message arg0) {
  |             // TODO Auto-generated method stub
  |             TextMessage tm = (TextMessage) arg0;
  |             try {
  |                     System.out.println("I'm alive - " + tm.getText());
  |             } catch (JMSException e) {
  |                     // TODO Auto-generated catch block
  |                     e.printStackTrace();
  |             }
  |     }
  | }

JBoss.xml:
<jboss>
  |  <enterprise-beans>
  |  <message-driven>
  |  <ejb-name>SSMListener</ejb-name>
  |  <local-jndi-name>jms/SSMListener</local-jndi-name>
  |  <destination-jndi-name>queue/SSMQueue</destination-jndi-name>
  |  </message-driven>
  |  </enterprise-beans>
  | </jboss>
  | 

destinations-service.xml
  <mbean code="org.jboss.mq.server.jmx.Queue"
  |      name="jboss.mq.destination:service=Queue,name=SSMQueue">
  |     <depends 
optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
  |   </mbean>
  | 

Here is are two snapshots of my JMX console.

http://img.picbite.com/2008/12/14/22833fjhhs.png
http://img.picbite.com/2008/12/14/22835imemm.png

I don't see any JMX controls for startDelivery or stopDelivery. 
o What am I doing wrong here? 
o Do I need to configure the MDB as an mbean?  

Remember - beginner... 

For start/stoping programatically I have the following code:
                ObjectName objectName;
  |             try {
  |                     objectName = new ObjectName(
  |                                     
"jboss.j2ee:binding=message-driven-bean, jndiName=jms/SSMListener, 
plugin=invoker,service=EJB");
  |                     MBeanServer server = MBeanServerLocator.locateJBoss();
  |                     server.invoke(objectName, "stopDelivery", new Object[] 
{}, null);
  |             } catch (MalformedObjectNameException e1) {
  |                     // TODO Auto-generated catch block
  |                     e1.printStackTrace();
  |             } catch (NullPointerException e1) {
  |                     // TODO Auto-generated catch block
  |                     e1.printStackTrace();
  |             } catch (InstanceNotFoundException e) {
  |                     // TODO Auto-generated catch block
  |                     e.printStackTrace();
  |             } catch (MBeanException e) {
  |                     // TODO Auto-generated catch block
  |                     e.printStackTrace();
  |             } catch (ReflectionException e) {
  |                     // TODO Auto-generated catch block
  |                     e.printStackTrace();
  |             }

This code generates exception:
anonymous wrote : 10:55:55,157 ERROR [STDERR] 
javax.management.InstanceNotFoundException: 
jboss.j2ee:binding=message-driven-bean, jndiName=jms/SSMListener, 
plugin=invoker,service=EJB is not registered.
  | 10:55:55,158 ERROR [STDERR]         at 
org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:529)
  | 10:55:55,158 ERROR [STDERR]         at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:662)
  | 10:55:55,158 ERROR [STDERR]         at 
com.sita.wab.service.SsimService.startLoad(SsimService.java:65)
  | 10:55:55,158 ERROR [STDERR]         at 
com.sita.wab.ejb.ssim.SsimEjbBean.startLoad(SsimEjbBean.java:32)

I suspect once I get the JMX issue resolved the answer to this problem will be 
obvious. 

Other than the starting/stopping the queue, everything else works well.

Please be cognizant that I have posted this on the "Beginners Corner" forum and 
I am not that familure with the details of JMX.

Any help will be greatly appreciated.   


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196406#4196406

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196406
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to