Examples of NotificationProducer


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

            Document eprDoc = env.getDocument(fileName);
            Element eprXML = XmlUtils.getFirstElement(eprDoc);
           
            EndpointReference epr = new EndpointReference(eprXML);
           
            NotificationProducer wsn =
                (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI);
           
            wsn.subscribe(epr, new TopicFilter(MuwsConstants.ADV_ME_CREATION_TOPIC), null, null);
            wsn.subscribe(epr, new TopicFilter(MuwsConstants.ADV_ME_DESTRUCTION_TOPIC), null, null);
        }
    }
View Full Code Here

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

        Filter filter = pullPointCap.getFilter();
       
        //
        // create subscription that will send messages to the pullpoint
        //
        NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI);
        WsResource sub = null;
       
        try
        {
            sub = wsn.subscribe(epr, filter, null, null);
        }
       
        catch (BaseFault error)
        {
            throw new UnableToCreatePullPointFault(error);
View Full Code Here

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

Examples of org.servicemix.ws.notification.NotificationProducer

            advisor.start();
        }
    }
   
    protected void fireDemandChangeEvent(boolean inDemand) {
        NotificationProducer p = createPublisherNotificationProducer();
        if( inDemand ) {
            SubscribeDocument requestDoc = SubscribeDocument.Factory.newInstance();
            Subscribe subscribe = requestDoc.addNewSubscribe();
            subscribe.setTopicExpression( TopicExpressionConverter.toTopicExpression(topic) );
            subscribe.setUseNotify(true);
            subscribe.setConsumerReference(endpointReference);
            SubscribeResponseDocument reponse = p.Subscribe(requestDoc);
        } else {
            UnsubscribeDocument requestDoc = UnsubscribeDocument.Factory.newInstance();
            Unsubscribe unsubscribe = requestDoc.addNewUnsubscribe();           
        }
    }
View Full Code Here

Examples of org.servicemix.ws.notification.NotificationProducer

            Unsubscribe unsubscribe = requestDoc.addNewUnsubscribe();           
        }
    }

    protected NotificationProducer createPublisherNotificationProducer() {
        return new NotificationProducer() {
            public SubscribeResponseDocument Subscribe(SubscribeDocument request) {
                throw new RuntimeException("Not implemented");
            }
            public GetCurrentMessageResponseDocument getCurrentMessage(GetCurrentMessageDocument request) {
                throw new RuntimeException("Not implemented");
View Full Code Here

Examples of org.servicemix.wspojo.notification.NotificationProducer

    // Implementation methods
    // -------------------------------------------------------------------------
    protected void fireDemandChangeEvent(boolean inDemand) throws RemoteException, SubscribeCreationFailedFault,
            ResourceUnknownFault, TopicPathDialectUnknownFault {
        NotificationProducer producer = createPublisherNotificationProducer();
        if (inDemand) {
            producer.subscribe(publisherReference, topicConverter.toTopicExpression(topic), useNotify, precondition,
                    selector, subscriptionPolicy, terminationTime);
        }
        else {

            // TODO how to unsubscribe?
View Full Code Here

Examples of org.servicemix.wspojo.notification.NotificationProducer

            // TODO how to unsubscribe?
        }
    }

    protected NotificationProducer createPublisherNotificationProducer() {
        return new NotificationProducer() {
            public EndpointReferenceType subscribe(
                    @WebParam(name = "ConsumerReference", targetNamespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd")
                    EndpointReferenceType consumerReference,
                    @WebParam(name = "TopicExpression", targetNamespace = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd")
                    TopicExpressionType topicExpression,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.