Package org.activemq.ws.xmlbeans.notification.base.SubscribeDocument

Examples of org.activemq.ws.xmlbeans.notification.base.SubscribeDocument.Subscribe


   
    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


            throw new RuntimeException(e);
        }
    }

    public SubscribeResponseDocument Subscribe(SubscribeDocument requestDoc) {
        Subscribe subscribe = requestDoc.getSubscribe();
       
        Calendar terminationTime = subscribe.getInitialTerminationTime();
        if( terminationTime!=null ) {
            // Termination time cannot be in the past
            if( terminationTime.before( Calendar.getInstance() ) ) {
                // Is this the right way to fault??
                throw new RuntimeException("Termination time cannot be in the past.");
            }           
            // We could fault here if the time is too far in the future.
        } else {
            // We could default a sensible timeout here.
        }

        ActiveMQSubscription subscription;
        try {
           
            subscription = new ActiveMQSubscription(connection);
            subscription.setTopicExpression(subscribe.getTopicExpression());
            subscription.setConsumerReference(subscribe.getConsumerReference());
            subscription.setPrecondition(subscribe.getPrecondition());
            subscription.setSelector(subscribe.getSelector());
            subscription.setSubscriptionPolicy(subscribe.getSubscriptionPolicy());
            subscription.setTopicExpression(subscribe.getTopicExpression());
            subscription.setUseNotify(subscribe.getUseNotify());
            subscription.setConsumer( createNotificationConsumer(subscribe.getConsumerReference()) );
           
            subscription.start();
           
        } catch (JMSException e) {
            throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of org.activemq.ws.xmlbeans.notification.base.SubscribeDocument.Subscribe

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.