You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by Makla <de...@yahoo.de> on 2008/10/29 12:04:13 UTC
Send NotificationEvent from additional Axis2 WS
Hello,
i have the following situation. A J2me client shall be able to notify a
NotificationProducerWS with certain events.
The NotificationProducer then publishes the event to all subscribed
listeners.
In the WSN Consumer/Producer sample, there is only a producer publishing
events every 10secs to its subscribers, no matter whether anything has
happened or not.
But I want a second (non-emuse) WS sending an event (incl. some data as for
instance a float value) to the producing notification WS. The producer then
pushes the notification message to the listeners.The
subscription/publication is no problem.
I was considering adding a method in the WSN-Producer implementation
(MyCapabilityImpl) that hands over the data and sets a flag for publication.
But how may i do this? and how may i access the Muse WS from outside and
invoke a method in it?
any help is much appreciated (urgent)
--
View this message in context: http://www.nabble.com/Send-NotificationEvent-from-additional-Axis2-WS-tp20224782p20224782.html
Sent from the Muse User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org
Re: SV: Send NotificationEvent from additional Axis2 WS
Posted by Agustin1984 <ja...@hotmail.com>.
My situation is this:
I have:
- a producer1 that produce an event each 10 seconds (as the samples provided
by muse)
- a consumer1 subscribed to producer 1
- a producer2
- many consumers subscribed to producer2
The following in my scenario:
when consumer1 receive message from producer1, it must publish this event to
consumers subscribed to producer2, how can I call publish method on
producer2 from consumer1?
Producer1--(notifyEvent)--->Consumer1--(receive message and publish this
message on producer2)
Makla wrote:
>
> Thanks a lot! I owe you one. Now I understand how things work out in
> muse..i even consider writing a tutorial about this - since there doesnt
> seem to be too many out there.
>
> Makla
>
>
> Lenni Madsen wrote:
>>
>> The sample is just a sample that for the sake of the sample continues to
>> produce messages at a given interval. In short it's a proof of concept
>> that
>> the messages can be sent and received.
>>
>> Now if we want to do something a bit more advanced to for example to have
>> a
>> central NotificationProducer that all the other WSRF compliant services
>> can
>> call, this might be a way:
>>
>> package org.extended.test;
>>
>> import javax.xml.namespace.QName;
>>
>> import org.apache.muse.core.Resource;
>> import org.apache.muse.core.ResourceManager;
>> import org.apache.muse.util.xml.XmlUtils;
>> import org.apache.muse.ws.addressing.EndpointReference;
>> import org.apache.muse.ws.addressing.soap.SoapFault;
>> import org.apache.muse.ws.dm.muws.events.Component;
>> import org.apache.muse.ws.dm.muws.events.ComponentAddress;
>> import org.apache.muse.ws.dm.muws.events.ManagementEvent;
>> import org.apache.muse.ws.dm.muws.events.Situation;
>> import org.apache.muse.ws.dm.muws.events.WefConstants;
>> import org.apache.muse.ws.dm.muws.events.WefFactory;
>> import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
>> import org.apache.muse.ws.dm.muws.impl.AbstractManageabilityCapability;
>> import org.apache.muse.ws.notification.NotificationProducer;
>> import org.apache.muse.ws.notification.WsnConstants;
>> import org.w3c.dom.Element;
>>
>> public class MyCapability extends AbstractManageabilityCapability
>> implements
>> IMyCapability
>> {
>>
>> private static final QName _TOPIC_NAME = new QName(NAMESPACE_URI,
>> "RuntimeEvent", PREFIX);
>> private WefFactory factory;
>> private ManagementEvent event;
>> private NotificationProducer runtimeNotification;
>>
>> /**
>> * Only internal objects are guaranteed to be instantiated, do not
>> depend on objects/Capabilities outside this Capability
>> */
>> public void initialize() throws SoapFault {
>> super.initialize();
>> Element[] elements =
>> getResource().getEndpointReference().getParameters();
>> System.out.println("Element Length: "+elements.length);
>> for(int i = 0; i < elements.length; i++){
>> System.out.println("Override initialization() for
>> "+elements[i].getFirstChild().getNodeValue());
>> }
>> _ServerName = "Extended";
>> }
>> /**
>> * External capabilities are instantiated and can be used
>> */
>> public void initializeCompleted() throws SoapFault {
>> super.initializeCompleted();
>> Element[] elements =
>> getResource().getEndpointReference().getParameters();
>> for(int i = 0; i < elements.length; i++){
>> System.out.println("Override
>> initializationCompleted() for
>> "+elements[i].getFirstChild().getNodeValue());
>> }
>> runtimeNotification =
>> (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI)
>> ;
>> // add list of Topics if needed
>> runtimeNotification.addTopic(_TOPIC_NAME);
>> }
>> /**
>> * External capabilities are instantiated and can be used (last
>> chance)
>> */
>> public void prepareShutdown() throws SoapFault{
>> super.prepareShutdown();
>> Element[] elements =
>> getResource().getEndpointReference().getParameters();
>> for(int i = 0; i < elements.length; i++){
>> System.out.println("Override prepareShutdown() for
>> "+elements[i].getFirstChild().getNodeValue());
>> }
>> }
>> /**
>> * Only internal objects are guarentied to be instantiated, do not
>> depend on objects/Capabilities outside this Capability
>> */
>> public void shutdown() throws SoapFault{
>> super.shutdown();
>> Element[] elements =
>> getResource().getEndpointReference().getParameters();
>> for(int i = 0; i < elements.length; i++){
>> System.out.println("Override shutown() for
>> "+elements[i].getFirstChild().getNodeValue());
>> }
>> }
>>
>> private String[] _TestProperty;
>>
>> public String[] getTestProperty()
>> {
>> return _TestProperty;
>> }
>>
>> public void setTestProperty(String[] param0)
>> {
>> _TestProperty = param0;
>> }
>>
>> public Element runtimeEventOperation(){
>> // WefFactory();
>> Element toPublish = MemoryFree();
>> try{
>> getLog().info("Sending message to consumers...");
>>
>> runtimeNotification.publish(_PDP_TOPIC_NAME,
>> toPublish);
>> // runtimeNotification.publish(_PDP_TOPIC_NAME, event);
>> }catch (Throwable error){
>> error.printStackTrace();
>> }
>> // return event.toXML();
>> return toPublish;
>> }
>>
>> private Element MemoryFree(){
>> Element ExtendedElement = XmlUtils.createElement(
>> new QName(
>> "someURI",
>> "SomeName",
>> "Some"
>> ),
>> 30.56
>> );
>> return ExtendedElement;
>> }
>>
>> private void WefFactory(){
>>
>> factory = new SimpleWefFactory();
>> event = factory.createEvent();
>>
>> Component reporter = factory.createComponent();
>> ComponentAddress reporterAddress =
>> factory.createComponentAddress(getResource().getEndpointReference().toXML())
>> ;
>> reporter.setAddress(reporterAddress);
>> reporter.setName(WefConstants.REPORTER_COMP_QNAME);
>> System.out.println("reporterAddress:
>> "+XmlUtils.toString(getResource().getEndpointReference().toXML()));
>> Component source = factory.createComponent();
>> ComponentAddress sourceAddress =
>> factory.createComponentAddress(getResource().getEndpointReference().toXML())
>> ;
>> source.setAddress(sourceAddress);
>> source.setName(WefConstants.SOURCE_COMP_QNAME);
>> System.out.println("sourceAddress:
>> "+XmlUtils.toString(getResource().getEndpointReference().toXML()));
>>
>> Situation situation = factory.createSituation();
>>
>> situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
>> situation.setPriority(Situation.HIGH_PRIORITY);
>> situation.setSeverity(Situation.UNKNOWN_SEVERITY);
>> situation.setMessage("Something important has happened in the
>> "+getServerName()+"!");
>> event.setReporter(reporter);
>> event.setSource(source);
>> event.setSituation(situation);
>> event.addExtendedElement(
>> new QName("SomeURI",
>> "SomeName", "tns"), 30.56);
>> // event.addExtendedElement(Element xml);
>> }
>>
>> private static final QName[] _PROPERTIES = new QName[]
>> {
>> new QName(NAMESPACE_URI, "ServerName", PREFIX),
>> new QName(NAMESPACE_URI, "MessageInterval", PREFIX),
>> new QName(NAMESPACE_URI, "TestProperty", PREFIX)
>> };
>>
>> public QName[] getPropertyNames()
>> {
>> return _PROPERTIES;
>> }
>>
>> private String _ServerName = "WsExtended";
>> private int _MessageInterval = 0;
>>
>> public String getServerName()
>> {
>> return _ServerName;
>> }
>>
>> public void setServerName(String param0)
>> {
>> _ServerName = param0;
>> }
>>
>> public int getMessageInterval()
>> {
>> return _MessageInterval;
>> }
>>
>> public void setMessageInterval(int param0)
>> {
>> _MessageInterval = param0;
>> }
>>
>> }
>>
>> Please note the code is not complete as it's sampled from a work in
>> progress, though it does contain a working NotificationProducer that
>> allows
>> for other WSRF services to use it.
>>
>> I didn't add the needed WSDL-file as I assumed you knew how to generate
>> those and declare any needed public available functions (in this case
>> runtimeEventOperation ).
>>
>> /Lenni
>>
>> "Cake is not a dual-use food stuff"
>> -----Oprindelig meddelelse-----
>> Fra: Makla [mailto:dennisfr1986@yahoo.de]
>> Sendt: 29. oktober 2008 12:04
>> Til: muse-user@ws.apache.org
>> Emne: Send NotificationEvent from additional Axis2 WS
>>
>>
>> Hello,
>>
>> i have the following situation. A J2me client shall be able to notify a
>> NotificationProducerWS with certain events.
>> The NotificationProducer then publishes the event to all subscribed
>> listeners.
>> In the WSN Consumer/Producer sample, there is only a producer publishing
>> events every 10secs to its subscribers, no matter whether anything has
>> happened or not.
>> But I want a second (non-emuse) WS sending an event (incl. some data as
>> for
>> instance a float value) to the producing notification WS. The producer
>> then
>> pushes the notification message to the listeners.The
>> subscription/publication is no problem.
>> I was considering adding a method in the WSN-Producer implementation
>> (MyCapabilityImpl) that hands over the data and sets a flag for
>> publication.
>> But how may i do this? and how may i access the Muse WS from outside and
>> invoke a method in it?
>>
>> any help is much appreciated (urgent)
>> --
>> View this message in context:
>> http://www.nabble.com/Send-NotificationEvent-from-additional-Axis2-WS-tp2022
>> 4782p20224782.html
>> Sent from the Muse User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: muse-user-help@ws.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: muse-user-help@ws.apache.org
>>
>>
>>
>
>
--
View this message in context: http://old.nabble.com/Send-NotificationEvent-from-additional-Axis2-WS-tp20224782p28913146.html
Sent from the Muse User mailing list archive at Nabble.com.
Re: SV: Send NotificationEvent from additional Axis2 WS
Posted by Makla <de...@yahoo.de>.
Thanks a lot! I owe you one. Now I understand how things work out in muse..i
even consider writing a tutorial about this - since there doesnt seem to be
too many out there.
Makla
Lenni Madsen wrote:
>
> The sample is just a sample that for the sake of the sample continues to
> produce messages at a given interval. In short it's a proof of concept
> that
> the messages can be sent and received.
>
> Now if we want to do something a bit more advanced to for example to have
> a
> central NotificationProducer that all the other WSRF compliant services
> can
> call, this might be a way:
>
> package org.extended.test;
>
> import javax.xml.namespace.QName;
>
> import org.apache.muse.core.Resource;
> import org.apache.muse.core.ResourceManager;
> import org.apache.muse.util.xml.XmlUtils;
> import org.apache.muse.ws.addressing.EndpointReference;
> import org.apache.muse.ws.addressing.soap.SoapFault;
> import org.apache.muse.ws.dm.muws.events.Component;
> import org.apache.muse.ws.dm.muws.events.ComponentAddress;
> import org.apache.muse.ws.dm.muws.events.ManagementEvent;
> import org.apache.muse.ws.dm.muws.events.Situation;
> import org.apache.muse.ws.dm.muws.events.WefConstants;
> import org.apache.muse.ws.dm.muws.events.WefFactory;
> import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
> import org.apache.muse.ws.dm.muws.impl.AbstractManageabilityCapability;
> import org.apache.muse.ws.notification.NotificationProducer;
> import org.apache.muse.ws.notification.WsnConstants;
> import org.w3c.dom.Element;
>
> public class MyCapability extends AbstractManageabilityCapability
> implements
> IMyCapability
> {
>
> private static final QName _TOPIC_NAME = new QName(NAMESPACE_URI,
> "RuntimeEvent", PREFIX);
> private WefFactory factory;
> private ManagementEvent event;
> private NotificationProducer runtimeNotification;
>
> /**
> * Only internal objects are guaranteed to be instantiated, do not
> depend on objects/Capabilities outside this Capability
> */
> public void initialize() throws SoapFault {
> super.initialize();
> Element[] elements =
> getResource().getEndpointReference().getParameters();
> System.out.println("Element Length: "+elements.length);
> for(int i = 0; i < elements.length; i++){
> System.out.println("Override initialization() for
> "+elements[i].getFirstChild().getNodeValue());
> }
> _ServerName = "Extended";
> }
> /**
> * External capabilities are instantiated and can be used
> */
> public void initializeCompleted() throws SoapFault {
> super.initializeCompleted();
> Element[] elements =
> getResource().getEndpointReference().getParameters();
> for(int i = 0; i < elements.length; i++){
> System.out.println("Override
> initializationCompleted() for
> "+elements[i].getFirstChild().getNodeValue());
> }
> runtimeNotification =
> (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI)
> ;
> // add list of Topics if needed
> runtimeNotification.addTopic(_TOPIC_NAME);
> }
> /**
> * External capabilities are instantiated and can be used (last
> chance)
> */
> public void prepareShutdown() throws SoapFault{
> super.prepareShutdown();
> Element[] elements =
> getResource().getEndpointReference().getParameters();
> for(int i = 0; i < elements.length; i++){
> System.out.println("Override prepareShutdown() for
> "+elements[i].getFirstChild().getNodeValue());
> }
> }
> /**
> * Only internal objects are guarentied to be instantiated, do not
> depend on objects/Capabilities outside this Capability
> */
> public void shutdown() throws SoapFault{
> super.shutdown();
> Element[] elements =
> getResource().getEndpointReference().getParameters();
> for(int i = 0; i < elements.length; i++){
> System.out.println("Override shutown() for
> "+elements[i].getFirstChild().getNodeValue());
> }
> }
>
> private String[] _TestProperty;
>
> public String[] getTestProperty()
> {
> return _TestProperty;
> }
>
> public void setTestProperty(String[] param0)
> {
> _TestProperty = param0;
> }
>
> public Element runtimeEventOperation(){
> // WefFactory();
> Element toPublish = MemoryFree();
> try{
> getLog().info("Sending message to consumers...");
>
> runtimeNotification.publish(_PDP_TOPIC_NAME,
> toPublish);
> // runtimeNotification.publish(_PDP_TOPIC_NAME, event);
> }catch (Throwable error){
> error.printStackTrace();
> }
> // return event.toXML();
> return toPublish;
> }
>
> private Element MemoryFree(){
> Element ExtendedElement = XmlUtils.createElement(
> new QName(
> "someURI",
> "SomeName",
> "Some"
> ),
> 30.56
> );
> return ExtendedElement;
> }
>
> private void WefFactory(){
>
> factory = new SimpleWefFactory();
> event = factory.createEvent();
>
> Component reporter = factory.createComponent();
> ComponentAddress reporterAddress =
> factory.createComponentAddress(getResource().getEndpointReference().toXML())
> ;
> reporter.setAddress(reporterAddress);
> reporter.setName(WefConstants.REPORTER_COMP_QNAME);
> System.out.println("reporterAddress:
> "+XmlUtils.toString(getResource().getEndpointReference().toXML()));
> Component source = factory.createComponent();
> ComponentAddress sourceAddress =
> factory.createComponentAddress(getResource().getEndpointReference().toXML())
> ;
> source.setAddress(sourceAddress);
> source.setName(WefConstants.SOURCE_COMP_QNAME);
> System.out.println("sourceAddress:
> "+XmlUtils.toString(getResource().getEndpointReference().toXML()));
>
> Situation situation = factory.createSituation();
>
> situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
> situation.setPriority(Situation.HIGH_PRIORITY);
> situation.setSeverity(Situation.UNKNOWN_SEVERITY);
> situation.setMessage("Something important has happened in the
> "+getServerName()+"!");
> event.setReporter(reporter);
> event.setSource(source);
> event.setSituation(situation);
> event.addExtendedElement(
> new QName("SomeURI",
> "SomeName", "tns"), 30.56);
> // event.addExtendedElement(Element xml);
> }
>
> private static final QName[] _PROPERTIES = new QName[]
> {
> new QName(NAMESPACE_URI, "ServerName", PREFIX),
> new QName(NAMESPACE_URI, "MessageInterval", PREFIX),
> new QName(NAMESPACE_URI, "TestProperty", PREFIX)
> };
>
> public QName[] getPropertyNames()
> {
> return _PROPERTIES;
> }
>
> private String _ServerName = "WsExtended";
> private int _MessageInterval = 0;
>
> public String getServerName()
> {
> return _ServerName;
> }
>
> public void setServerName(String param0)
> {
> _ServerName = param0;
> }
>
> public int getMessageInterval()
> {
> return _MessageInterval;
> }
>
> public void setMessageInterval(int param0)
> {
> _MessageInterval = param0;
> }
>
> }
>
> Please note the code is not complete as it's sampled from a work in
> progress, though it does contain a working NotificationProducer that
> allows
> for other WSRF services to use it.
>
> I didn't add the needed WSDL-file as I assumed you knew how to generate
> those and declare any needed public available functions (in this case
> runtimeEventOperation ).
>
> /Lenni
>
> "Cake is not a dual-use food stuff"
> -----Oprindelig meddelelse-----
> Fra: Makla [mailto:dennisfr1986@yahoo.de]
> Sendt: 29. oktober 2008 12:04
> Til: muse-user@ws.apache.org
> Emne: Send NotificationEvent from additional Axis2 WS
>
>
> Hello,
>
> i have the following situation. A J2me client shall be able to notify a
> NotificationProducerWS with certain events.
> The NotificationProducer then publishes the event to all subscribed
> listeners.
> In the WSN Consumer/Producer sample, there is only a producer publishing
> events every 10secs to its subscribers, no matter whether anything has
> happened or not.
> But I want a second (non-emuse) WS sending an event (incl. some data as
> for
> instance a float value) to the producing notification WS. The producer
> then
> pushes the notification message to the listeners.The
> subscription/publication is no problem.
> I was considering adding a method in the WSN-Producer implementation
> (MyCapabilityImpl) that hands over the data and sets a flag for
> publication.
> But how may i do this? and how may i access the Muse WS from outside and
> invoke a method in it?
>
> any help is much appreciated (urgent)
> --
> View this message in context:
> http://www.nabble.com/Send-NotificationEvent-from-additional-Axis2-WS-tp2022
> 4782p20224782.html
> Sent from the Muse User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Send-NotificationEvent-from-additional-Axis2-WS-tp20224782p20358137.html
Sent from the Muse User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org
SV: Send NotificationEvent from additional Axis2 WS
Posted by Lenni Madsen <l....@mil.dk>.
The sample is just a sample that for the sake of the sample continues to
produce messages at a given interval. In short it's a proof of concept that
the messages can be sent and received.
Now if we want to do something a bit more advanced to for example to have a
central NotificationProducer that all the other WSRF compliant services can
call, this might be a way:
package org.extended.test;
import javax.xml.namespace.QName;
import org.apache.muse.core.Resource;
import org.apache.muse.core.ResourceManager;
import org.apache.muse.util.xml.XmlUtils;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.dm.muws.events.Component;
import org.apache.muse.ws.dm.muws.events.ComponentAddress;
import org.apache.muse.ws.dm.muws.events.ManagementEvent;
import org.apache.muse.ws.dm.muws.events.Situation;
import org.apache.muse.ws.dm.muws.events.WefConstants;
import org.apache.muse.ws.dm.muws.events.WefFactory;
import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
import org.apache.muse.ws.dm.muws.impl.AbstractManageabilityCapability;
import org.apache.muse.ws.notification.NotificationProducer;
import org.apache.muse.ws.notification.WsnConstants;
import org.w3c.dom.Element;
public class MyCapability extends AbstractManageabilityCapability implements
IMyCapability
{
private static final QName _TOPIC_NAME = new QName(NAMESPACE_URI,
"RuntimeEvent", PREFIX);
private WefFactory factory;
private ManagementEvent event;
private NotificationProducer runtimeNotification;
/**
* Only internal objects are guaranteed to be instantiated, do not
depend on objects/Capabilities outside this Capability
*/
public void initialize() throws SoapFault {
super.initialize();
Element[] elements =
getResource().getEndpointReference().getParameters();
System.out.println("Element Length: "+elements.length);
for(int i = 0; i < elements.length; i++){
System.out.println("Override initialization() for
"+elements[i].getFirstChild().getNodeValue());
}
_ServerName = "Extended";
}
/**
* External capabilities are instantiated and can be used
*/
public void initializeCompleted() throws SoapFault {
super.initializeCompleted();
Element[] elements =
getResource().getEndpointReference().getParameters();
for(int i = 0; i < elements.length; i++){
System.out.println("Override
initializationCompleted() for "+elements[i].getFirstChild().getNodeValue());
}
runtimeNotification =
(NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI)
;
// add list of Topics if needed
runtimeNotification.addTopic(_TOPIC_NAME);
}
/**
* External capabilities are instantiated and can be used (last
chance)
*/
public void prepareShutdown() throws SoapFault{
super.prepareShutdown();
Element[] elements =
getResource().getEndpointReference().getParameters();
for(int i = 0; i < elements.length; i++){
System.out.println("Override prepareShutdown() for
"+elements[i].getFirstChild().getNodeValue());
}
}
/**
* Only internal objects are guarentied to be instantiated, do not
depend on objects/Capabilities outside this Capability
*/
public void shutdown() throws SoapFault{
super.shutdown();
Element[] elements =
getResource().getEndpointReference().getParameters();
for(int i = 0; i < elements.length; i++){
System.out.println("Override shutown() for
"+elements[i].getFirstChild().getNodeValue());
}
}
private String[] _TestProperty;
public String[] getTestProperty()
{
return _TestProperty;
}
public void setTestProperty(String[] param0)
{
_TestProperty = param0;
}
public Element runtimeEventOperation(){
// WefFactory();
Element toPublish = MemoryFree();
try{
getLog().info("Sending message to consumers...");
runtimeNotification.publish(_PDP_TOPIC_NAME,
toPublish);
// runtimeNotification.publish(_PDP_TOPIC_NAME, event);
}catch (Throwable error){
error.printStackTrace();
}
// return event.toXML();
return toPublish;
}
private Element MemoryFree(){
Element ExtendedElement = XmlUtils.createElement(
new QName(
"someURI",
"SomeName",
"Some"
),
30.56
);
return ExtendedElement;
}
private void WefFactory(){
factory = new SimpleWefFactory();
event = factory.createEvent();
Component reporter = factory.createComponent();
ComponentAddress reporterAddress =
factory.createComponentAddress(getResource().getEndpointReference().toXML())
;
reporter.setAddress(reporterAddress);
reporter.setName(WefConstants.REPORTER_COMP_QNAME);
System.out.println("reporterAddress:
"+XmlUtils.toString(getResource().getEndpointReference().toXML()));
Component source = factory.createComponent();
ComponentAddress sourceAddress =
factory.createComponentAddress(getResource().getEndpointReference().toXML())
;
source.setAddress(sourceAddress);
source.setName(WefConstants.SOURCE_COMP_QNAME);
System.out.println("sourceAddress:
"+XmlUtils.toString(getResource().getEndpointReference().toXML()));
Situation situation = factory.createSituation();
situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
situation.setPriority(Situation.HIGH_PRIORITY);
situation.setSeverity(Situation.UNKNOWN_SEVERITY);
situation.setMessage("Something important has happened in the
"+getServerName()+"!");
event.setReporter(reporter);
event.setSource(source);
event.setSituation(situation);
event.addExtendedElement(
new QName("SomeURI",
"SomeName", "tns"), 30.56);
// event.addExtendedElement(Element xml);
}
private static final QName[] _PROPERTIES = new QName[]
{
new QName(NAMESPACE_URI, "ServerName", PREFIX),
new QName(NAMESPACE_URI, "MessageInterval", PREFIX),
new QName(NAMESPACE_URI, "TestProperty", PREFIX)
};
public QName[] getPropertyNames()
{
return _PROPERTIES;
}
private String _ServerName = "WsExtended";
private int _MessageInterval = 0;
public String getServerName()
{
return _ServerName;
}
public void setServerName(String param0)
{
_ServerName = param0;
}
public int getMessageInterval()
{
return _MessageInterval;
}
public void setMessageInterval(int param0)
{
_MessageInterval = param0;
}
}
Please note the code is not complete as it's sampled from a work in
progress, though it does contain a working NotificationProducer that allows
for other WSRF services to use it.
I didn't add the needed WSDL-file as I assumed you knew how to generate
those and declare any needed public available functions (in this case
runtimeEventOperation ).
/Lenni
"Cake is not a dual-use food stuff"
-----Oprindelig meddelelse-----
Fra: Makla [mailto:dennisfr1986@yahoo.de]
Sendt: 29. oktober 2008 12:04
Til: muse-user@ws.apache.org
Emne: Send NotificationEvent from additional Axis2 WS
Hello,
i have the following situation. A J2me client shall be able to notify a
NotificationProducerWS with certain events.
The NotificationProducer then publishes the event to all subscribed
listeners.
In the WSN Consumer/Producer sample, there is only a producer publishing
events every 10secs to its subscribers, no matter whether anything has
happened or not.
But I want a second (non-emuse) WS sending an event (incl. some data as for
instance a float value) to the producing notification WS. The producer then
pushes the notification message to the listeners.The
subscription/publication is no problem.
I was considering adding a method in the WSN-Producer implementation
(MyCapabilityImpl) that hands over the data and sets a flag for publication.
But how may i do this? and how may i access the Muse WS from outside and
invoke a method in it?
any help is much appreciated (urgent)
--
View this message in context:
http://www.nabble.com/Send-NotificationEvent-from-additional-Axis2-WS-tp2022
4782p20224782.html
Sent from the Muse User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org