Package org.servicemix.ws.notification

Examples of org.servicemix.ws.notification.NotificationException


    protected InvokerSupport createDispatcher(SubscribeDocument.Subscribe subscribe) {
        try {
            ServiceEndpoint endpoint = findSubscriberEndpoint(subscribe);
            if (endpoint == null) {
                throw new NotificationException("Could not find a suitable JBI ServiceEndpoint reference for the consumerReference: " + subscribe.getConsumerReference());
            }
            JBIInvoker invoker = new JBIInvoker(context.getDeliveryChannel(), endpoint, subscribe);
            return invoker;
        }
        catch (MessagingException e) {
            throw new NotificationException(e);
        }
    }
View Full Code Here


     * Extracts the subscriber endpoint from the subscription request using the serviceName or the portType
     */
    protected ServiceEndpoint findSubscriberEndpoint(SubscribeDocument.Subscribe subscribe) {
        org.servicemix.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType consumerReference = subscribe.getConsumerReference();
        if (consumerReference == null) {
            throw new NotificationException("No consumerReference specified for subscription: " + subscribe);
        }
        org.servicemix.ws.xmlbeans.addressing.v2003_03.ServiceNameType serviceNameType = consumerReference.getServiceName();
        if (serviceNameType == null) {
            log.warn("No service name available for subscription: " + subscribe);
        }
View Full Code Here

        Calendar terminationTime = publisherInfo.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 NotificationException("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.
        }
       
        // Create publisher and assoicate an EndpointReference with it.
        EndpointReferenceType registrationEndpointReference;
        try {

            ActiveMQPublisherRegistration publisher = new ActiveMQPublisherRegistration(connection);
            registrationEndpointReference = publisherManager.register(publisher);
            publisher.setEndpointReference(registrationEndpointReference);
            publisher.setTerminationTime(terminationTime);
            publisher.setDemand(publisherInfo.getDemand());

            if (publisherInfo.getDemand()) {
                publisher.setPublisherReference(publisherInfo.getPublisherReference());
            }

            publisher.setTopic(topic);
            publisher.start();

        }
        catch (JMSException e) {
            throw new NotificationException(e);
        }
       
        // Send response.
        RegisterPublisherResponseDocument responseDoc = RegisterPublisherResponseDocument.Factory.newInstance();
        RegisterPublisherResponse response = responseDoc.addNewRegisterPublisherResponse();
View Full Code Here

                ActiveMQPublisherRegistration publisher = getPublisher(producerReference);
                publisher.notify(topic, messageHolder.getMessage());
            }
        }
        catch (IOException e) {
            throw new NotificationException(e);
        }
        catch (JMSException e) {
            throw new NotificationException(e);
        }
    }
View Full Code Here

        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 NotificationException("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.setDispatcher(createDispatcher(subscribe));

            subscription.start();

        }
        catch (JMSException e) {
            throw new NotificationException(e);
        }

        EndpointReferenceType endpointReference = subscriptionManager.register(subscription);
        subscription.setEndpointReference(endpointReference);
       
View Full Code Here

            }
        };
    }

    public GetCurrentMessageResponseDocument getCurrentMessage(GetCurrentMessageDocument request) {
        throw new NotificationException("Not supported");
    }
View Full Code Here

TOP

Related Classes of org.servicemix.ws.notification.NotificationException

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.