|
Home > Archive > WebSphere Application Server > May 2005 > MBean Remote Notification WAS6.0
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
MBean Remote Notification WAS6.0
|
|
|
| Hi
I'm having a problem with Remote Notification from my standard MBean registered in Websphere 6.0
Details:
I created a Standard MBean which extends NotificationBroadcasterSupport and implements my Standard MBean Interface. In one of the Operations i added the code for sending the Notification
Code Extract:
Notification notif = new Notification("Test",this,0,pid+" CountAdded");
notif.setUserData(htStatus); // htStatus is a Hashtable
sendNotification(notif);
Through the servlet i register this MBean using the following
mbs = AdminServiceFactory.getMBeanFactory().getMBeanServer() ;
mBeanName = new ObjectName("TestJMX:name=MyTestMBean");
myMBean = new MyTest();
mbs.registerMBean(myMBean,mBeanName);
I've written a standalone client application which acts as a NotificationListener which uses the AdminClient API to
access the MBeans and register as NotificationListener
CodeExtract:
Properties connectProps = new Properties();
connectProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP );
connectProps.setProperty(AdminClient.CONNECTOR_HOST, "localhost");
connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8880");
// Get an AdminClient based on the connector properties
try
{
adminClient = AdminClientFactory.createAdminClient(connectProps);
}
//Get MBean Object Name
String query = "TestJMX:*,name=MyTestMBean";
ObjectName queryName = new ObjectName(query);
Set s = adminClient.queryNames(queryName, null);
if (!s.isEmpty())
{
mBeanName = (ObjectName)s.iterator().next();
}
//Register as Listener
adminClient.addNotificationListener(mBeanName, this, null, null);
//Handle Notification
public void handleNotification(Notification ntfyObj, Object handback) {
ntfyCount++;
System.out.println(" ****************************************
***********");
System.out.println("* Notification received at " + new Date().toString());
System.out.println("* type = " + ntfyObj.getType());
}
I started the Listener., but i'm unable to recieve any notification during the corresponding method call in the Mbean that sends the notifications.
However when i added the listener in the servlet where i register the Mbean i'm able to get the notification.
Can some body help me on this???
| |
| Ken Hygh 2005-05-15, 5:50 pm |
| mukundh_s@yahoo.com wrote:
>Hi
>I'm having a problem with Remote Notification from my standard MBean registered in Websphere 6.0
>Details:
>I created a Standard MBean which extends NotificationBroadcasterSupport and implements my Standard MBean Interface. In one of the Operations i added the code for sending the Notification
>Code Extract:
>
>
[snip]
I've had luck with getting notifications, but you typically have to
start a thread for the listener, so it can process the notifications.
Ken
|
|
|
|
|