Thanks for your reply Balan.
I tried a lot, still i am not able to get notification events on consumer
side for *ManagementEventTopics*. Please direct me if there is any sample
code showing its implementation. I already tried the *filesystem* and *
enterprise* example that comes along with muse1.0.
In filesystem example, the code provieded for publishing via
ManagementEventTopic is as follows:
public void updateOperationalStatus(
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus.EnumnewStatus)
{
org.apache.ws.notification.base.NotificationProducerResourceresource = (
org.apache.ws.notification.base.NotificationProducerResource)getResource();
org.apache.ws.resource.properties.ResourceProperty statusProp =
resource.getResourcePropertySet().get(
FilesystemPropertyQNames.OPERATIONALSTATUS);
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatuscurrentStatus
= (
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus)
statusProp.get(0);
if (!currentStatus.enumValue().equals(newStatus))
{
org.apache.xmlbeans.XmlObject oldStatus =
org.apache.ws.util.XmlBeanUtils.copyXmlBean(currentStatus);
currentStatus.set(newStatus);
* org.apache.ws.notification.topics.TopicSpace muwsTopicSpace =
resource.getTopicSpaceSet().getTopicSpace(
org.apache.ws.muws.v1_0.MuwsConstants.NSURI_MUWS_PART2_TOPICS);
org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImplstatusTopic
= (
org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl)
muwsTopicSpace.getTopic(
org.apache.ws.muws.v1_0.capability.OperationalStatusCapability.TOPIC_NAME);
org.apache.ws.resource.properties.ResourcePropertyValueChangeEventstatusChangeEvent
= new
org.apache.ws.resource.properties.v2004_06.impl.XmlBeansResourcePropertyValueChangeEvent(new
Object[]{oldStatus}, new Object[]{currentStatus});
statusTopic.propertyChanged(statusChangeEvent); // publish the
event
* }
return;
}
But the consumer subscribed for OperationalStatusCapability is not getting
notifications i.e the notify method on consumer is not getting invoked.
So i tried using the ReqourcePropertyValueChangeTopic and made the following
changes.
public void updateOperationalStatus(
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus.EnumnewStatus)
{
System.out.println("UPDATING OPERATIONAL STATUS");
org.apache.ws.notification.base.NotificationProducerResourceresource = (
org.apache.ws.notification.base.NotificationProducerResource)getResource();
org.apache.ws.resource.properties.ResourceProperty statusProp =
((FilesystemResource)getResource()).getResourcePropertySet().get(
FilesystemPropertyQNames.OPERATIONALSTATUS);
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatuscurrentStatus
= (
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.OperationalStatus)
statusProp.get(0);
if (!currentStatus.enumValue().equals(newStatus))
{
org.apache.xmlbeans.XmlObject oldStatus =
org.apache.ws.util.XmlBeanUtils.copyXmlBean(currentStatus);
currentStatus.set(newStatus);
* org.apache.ws.notification.topics.TopicSpace muwsTopicSpace =
resource.getTopicSpaceSet().getTopicSpace(statusProp.getMetaData
().getName().getNamespaceURI());
org.apache.ws.notification.topics.ResourcePropertyValueChangeTopicvalueChangeTopic=(
org.apache.ws.notification.topics.ResourcePropertyValueChangeTopic
)muwsTopicSpace.getTopic("OperationalStatus");
org.apache.ws.resource.properties.ResourcePropertyValueChangeEventstatusChangeEvent
= new
org.apache.ws.resource.properties.v2004_06.impl.XmlBeansResourcePropertyValueChangeEvent(new
Object[]{oldStatus}, new Object[]{currentStatus});
valueChangeTopic.propertyChanged(statusChangeEvent); // publish
the event
* }
return;
}
It worked. The consumer subscribing for OperationalStatus Topic is able to
get the notification events. But I think it may not be the clean way to do
things, how can I make use of MUWS defined Management Event CapabilityTopics
for acheiving this??
Please help.. I appreciate your help in this matter.
On 6/28/06, Balan Subramanian <[EMAIL PROTECTED]> wrote:
Hi Pushkar,
I hope I understood your question properly.....
The ResourcePropertyValueChangeTopic is used to publish notifications
about property changes among the resource properties defined for that
resource. Each notification carries the new value of the property and may
carry the old value of the property as well. This is particularly useful
in monitoring scenarios. These events are described in the WS-RP
specifications.
The ManagementEventTopic is used to publish notifications of WSDM events
in the WSDM Event Format. The format is specificed in the muws-1 spec.
Typically these would be events that are generated by the resource other
than property change notifications for example, a heart beat sent by a
resource.
I am not sure why you cannot get the ManagementEvents in the notify method
if you are subscribed to the topic properly. I'll try out some samples
today but maybe someone has an answer to that already.
Thanks,
Balan
Balan Subramanian
Autonomic Computing, IBM, RTP, NC
919.543.0197 | [EMAIL PROTECTED]
"Pushkar Sachdeva" <[EMAIL PROTECTED]>
06/28/2006 09:50 AM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Help regarding muse notifications
I am new to using notifications in muse. I have the following queries:-
1) What is the difference between *ResourcePropertyValueChangeTopic* and *
ManagementEventTopic* ??
2) If in the Notification Producer,
*ResourcePropertyValueChangeTopic*sends
*ResourcePropertyValueChangeEvent* then that notification can be obtained
in
the notify function of Notification Consumer, but on the other hand If *
ManagementEventTopic* sends the *ResourcePropertyValueChangeEvent* then
the
notification is not automatically received in the notify function of the
Notification Consumer. However, in the latter case, Consumer can obtain
the
notification sent through *getCurrentMessage* request. How can i obtain
this
notification triggered by *ManagementEventTopic* automatically without
actually sending the request(the same way I obtained through *
ResourcePropertyValueChangeTopic*) ??
Please help me answer these questions or atleast direct me from where I
could clear my doubts.
Thanks a lot in advance.
-Regards
Pushkar