Package org.apache.muse.ws.notification

Examples of org.apache.muse.ws.notification.NotificationProducer


        super.initializeCompleted();
       
        //
        // access resource's WSN capability and create a new topic
        //
        final NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI);
        wsn.addTopic(_TOPIC_NAME);

        Thread producer = new Thread() {
            public void run()
            {
                //
                // for this example, reuse one payload for every notification
                //
                QName messageName = new QName(NAMESPACE_URI, "MyMessage", PREFIX);
                String message = "This is a message from " + getServerName();
                Element payload = XmlUtils.createElement(messageName, message);
               
                while (true)
                {
                    try
                    {
                        //
                        // read current value - property is mutable
                        //
                        int currentInterval = getMessageInterval();
                       
                        getLog().info("Waiting " + currentInterval + " seconds before sending message...");
                        Thread.currentThread().sleep(currentInterval * 1000);
                       
                        //
                        // use WSN capability to send message to any subscribers
                        //
                        getLog().info("Sending message to consumers...");
                        wsn.publish(_TOPIC_NAME, payload);
                    }

                    catch (Throwable error)
                    {
                        error.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.muse.ws.notification.NotificationProducer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.