Author |
Message
|
dakshinabalu |
Posted: Sun Apr 08, 2007 11:34 am Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi All everybody have a nice long weekened
How to get the particular MQ Listener in the WebSphere5.0 and get the ListenerStatus and Restart/Start/Stop the Listener Programmatically using JMX
----------------------------------------------------------------
Here is the Code
1)How Can get the ListenermBean from mBeans
2)How to get ListenerName from ListenermBean by passing name of the listener
3)How can the Listener Status from Listener mBean
4)How Can I restart/start/stop the listener without restarting the AppServer Websphere5.0
----------------------------------------------------
PmiClient pmiClnt=new PmiClient(nodeName,
port,"WAS50",false,connectorType);
javax.management.ObjectName
onames[]=pmiClnt.listMBeans(nodeName,serverName);
if(onames!=null){
AttributeList al;
ObjectName on;
for(int i=0;i<onames.length;i++)
{
on=onames[i];
String type=on.getKeyProperty("type");
com.ibm.websphere.management.ObjectNameHelper
objHelper=new
com.ibm.websphere.management.ObjectNameHelper();
String objType=objHelper.getMBeanType(on);
String objName=objHelper.getMBeanIdentifier(on);
if(type.equals("ListnerManagement")||on.equals("ListnerPort")||type.equals("ListnerPort")||
type.equals("Server"))
{
on.getStatus();>>>>>throwing error
on.ListernerStatus()>>throws error no such method
// Determine if current thread has lock for object on
hasLock = Thread.holdsLock(on); // false
synchronized (on)
{
//get the lock of the object on
hasLock = Thread.holdsLock(on);
if(hasLock==true)
{
listenerThread=Thread.currentThread();
ThreadGroup root =
Thread.currentThread().getThreadGroup().getParent();
listenerThreadName=listenerThread.getName();
//listenerThreadId=listenerThread.getId(); >>>throws error
//listenerThread.ListenerStatus();>>>theows error nosuch method
if(listenerThread.isAlive())
{
listenerThread.interrupt();
}
else
{
listenerThread.start();
}
}
}//haslock if close
else{
}
Advance Thanks |
|
Back to top |
|
|
jefflowrey |
Posted: Sun Apr 08, 2007 2:43 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Moderators - please move this question to WID/WPS/WAS+.
The MQ listener is entirely a separate thing from anything you can manage with JMX.
Are you trying to manage the ListenerPort, or the MQ listener? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
|
bduncan |
Posted: Sun Apr 08, 2007 9:54 pm Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
dakshinabalu do NOT post your questions multiple times. EVER. Wasting my time to delete your duplicate posts is a sure-fire way to get removed from the site. _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
|
dakshinabalu |
Posted: Mon Apr 09, 2007 6:32 am Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi
My requirement is need to start/restart the MQ Listener in WebSphere5.0 System Console without restarting the WebSphere5.0 Application Server.
This is part of JMX.
Does it serve the purpose if restart the MQ Listener Port
What is the difference between Restart/Start the MQ Listener and MQ Listener Port in the WebSphere5.0 System Console
Advance Thanks
regards
bala |
|
Back to top |
|
|
dakshinabalu |
Posted: Mon Apr 09, 2007 6:33 am Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi Jeff
Hi
My requirement is need to start/restart the MQ Listener in WebSphere5.0 System Console without restarting the WebSphere5.0 Application Server.
This is part of JMX.
Does it serve the purpose if restart the MQ Listener Port
What is the difference between Restart/Start the MQ Listener and MQ Listener Port in the WebSphere5.0 System Console .
How I can do Listener Restart Programmatically using JMX
Advance Thanks
regards
bala |
|
Back to top |
|
|
dakshinabalu |
Posted: Mon Apr 09, 2007 6:52 am Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi Jeff
You mentioned about Listener Port
I think this is the one
ListenerPort MBean
Management interface for JMS MessageListenerService ListenerPort
--------------------------------------------------------------------------------
Attribute Summary
java.lang.String jmsConnJNDIName
The JNDI name for the JMS ConnectionFactory in use by this ListenerPort.
java.lang.String jmsDestJNDIName
The JNDI name for the JMS Queue or Topic in use by this ListenerPort.
java.lang.Integer maxSessions
The value of max sessions in use by this ListenerPort.
java.lang.Integer maxRetries
The value of max retries in use by this ListenerPort.
java.lang.Integer maxMessages
The value of max messages in use by this ListenerPort.
java.lang.Boolean started
Indicates whether this ListenerPort is started.
Operation Summary
void start()
Start the ListenerPort.
void stop()
Stop the ListenerPort.
Attribute Detail
jmsConnJNDIName
public java.lang.String jmsConnJNDIName
The JNDI name for the JMS ConnectionFactory in use by this ListenerPort.
--------------------------------------------------------------------------------
jmsDestJNDIName
public java.lang.String jmsDestJNDIName
The JNDI name for the JMS Queue or Topic in use by this ListenerPort.
--------------------------------------------------------------------------------
maxSessions
public java.lang.Integer maxSessions
The value of max sessions in use by this ListenerPort.
--------------------------------------------------------------------------------
maxRetries
public java.lang.Integer maxRetries
The value of max retries in use by this ListenerPort.
--------------------------------------------------------------------------------
maxMessages
public java.lang.Integer maxMessages
The value of max messages in use by this ListenerPort.
--------------------------------------------------------------------------------
started
public java.lang.Boolean started
Indicates whether this ListenerPort is started.
--------------------------------------------------------------------------------
Operation Detail
start
public void start()
Start the ListenerPort.
--------------------------------------------------------------------------------
stop
public void stop()
Stop the ListenerPort.
--------------------------------------------------------------------------------
Copyright IBM Corp. 1996-2003
----------------------------------------------------------
But my requirement is to start the Configured MQ Listener in the System Console , but this is the JMS Listener Service Listener Port
Does it help?
Advance Thanks
regards
bala |
|
Back to top |
|
|
jefflowrey |
Posted: Mon Apr 09, 2007 12:07 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yes. The MDB Listener port can be managed by JMX.
The MQ Listener Port, that is hosted by runmqslr, can not be managed by JMX.
Except if JMX lets you run external OS commands, like "runmqlsr". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
|
dakshinabalu |
Posted: Mon Apr 09, 2007 12:51 pm Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi Jeff
Thans
but I need clarification
that is if the MQ /JMS Listener related to MDB can be controlled by JMX
if the MQ Listener configured in WebSphere System Console can not be controlled by JMX
Is it correct?, that's what you want to say ?
If it is the case JMX's intention is wrong, JMX is to control the system resources , performance statistics etc
Thanks
regards
bala |
|
Back to top |
|
|
jefflowrey |
Posted: Mon Apr 09, 2007 1:17 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I don't know what you mean by "The WebSphere System Console".
I don't know for sure that JMX can manage any MDB Listener Ports that are defined in the Application Server configuration.
I do know for a fact that the WebSphere MQ product is not written in Java, and thus does not expose any JMX management interfaces. And thus, you can't manage the WebSphere MQ product from JMX, without calling out to OS level commands, like runmqlsr or endmqm or etc.
And you're mostly wrong about JMX. JMX is intended to manage Java processes and Java resources, not act as a generic OS level controller, capable of for example unmounting a disk drive or copying files from one machine to another. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
|
dakshinabalu |
Posted: Mon Apr 09, 2007 2:53 pm Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi Jeff
I agree with what you are saying, JMX is not meant for OS Level activities.
I would like to highlight
1)The MQ Listener running in System Console means WebSphere 5.0 Application Server Administation Console that's what I mean.
2)In MQ Explorer or IBM Websphere MQ or MQ (old terminology) MQ Listener is different /In MQ Explorer Queue Manager, Queue Names, Channels etc
3)Third thing is there is something JMS Listener that's what for Message Driven Bean
I am not refering 2 or 3
I am refering 1
I hope clarified your doubt
Thanks
regards
bala |
|
Back to top |
|
|
jefflowrey |
Posted: Mon Apr 09, 2007 2:54 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, I don't know what #1 is.
I only ever used WAS 5.1 and v6.x. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
|
dakshinabalu |
Posted: Mon Apr 09, 2007 3:51 pm Post subject: How to Start MQ Listener Programmatically WebSphere5 use JMX |
|
|
Newbie
Joined: 08 Apr 2007 Posts: 9
|
Hi Jeff
This is what I am refering NO 1
The MQ Listener running in System Console means WebSphere 5.0 Application Server Administation Console that's what I mean.
Thanks
Bala |
|
Back to top |
|
|
jefflowrey |
Posted: Mon Apr 09, 2007 4:13 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Right, I understand what you're describing, I just don't know what it is. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
|
|