Package org.mule.api

Examples of org.mule.api.MessagingException


                WorkManager.INDEFINITE, null, new AsyncWorkListener(next));
            fireAsyncScheduledNotification(event);
        }
        catch (Exception e)
        {
            new MessagingException(CoreMessages.errorSchedulingMessageProcessorForAsyncInvocation(next),
                event, e, this);
        }
    }
View Full Code Here


                executionTemplate.execute(new ExecutionCallback<MuleEvent>()
                {
                    @Override
                    public MuleEvent process() throws Exception
                    {
                        MessagingException exceptionThrown = null;
                        try
                        {
                            processNextTimed(event);
                        }
                        catch (MessagingException e)
                        {
                            exceptionThrown = e;
                            throw e;
                        }
                        catch (Exception e)
                        {
                            exceptionThrown = new MessagingException(event, e, next);
                            throw exceptionThrown;
                        }
                        finally
                        {
                            firePipelineNotification(event, exceptionThrown);
View Full Code Here

        {
            methodName = (String)event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY, PropertyScope.INVOCATION);

            if (null == methodName)
            {
                throw new MessagingException(RmiMessages.messageParamServiceMethodNotSet(), event);
            }
        }

        Class[] argTypes = getArgTypes(event.getMessage().getInvocationProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES), event);
View Full Code Here

        {
            long timeout = ((HttpsConnector) getConnector()).getSslHandshakeTimeout();
            boolean handshakeComplete = getHttpServerConnection().getSslSocketHandshakeCompleteLatch().await(timeout, TimeUnit.MILLISECONDS);
            if (!handshakeComplete)
            {
                throw new MessagingException(HttpMessages.sslHandshakeDidNotComplete(), muleEvent);
            }
        }
        catch (InterruptedException e)
        {
            throw new MessagingException(HttpMessages.sslHandshakeDidNotComplete(),
                                         muleEvent, e);
        }
        if (getHttpServerConnection().getPeerCertificateChain() != null)
        {
            muleEvent.getMessage().setOutboundProperty(HttpsConnector.PEER_CERTIFICATES, getHttpServerConnection().getPeerCertificateChain());
View Full Code Here

        {
            socket = getSocket(endpoint);
        }
        catch (Exception e)
        {
            throw new MessagingException(CoreMessages.failedToGetOutputStream(), message, e);
        }
        if (socket == null)
        {
            // This shouldn't happen
            throw new IllegalStateException("could not get socket for endpoint: "
                    + endpoint.getEndpointURI().getAddress());
        }
        try
        {
            return new CallbackOutputStream(
                    new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())),
                    new CallbackOutputStream.Callback()
                    {
                        public void onClose() throws Exception
                        {
                            releaseSocket(socket, endpoint);
                        }
                    });
        }
        catch (IOException e)
        {
            throw new MessagingException(CoreMessages.failedToGetOutputStream(), message, e);
        }
    }
View Full Code Here

            this.adapter.fetchAccessToken(requestTokenUrl, this.getAccessTokenUrl(), authorizationUrl,
                this.getRedirectUri());
        }
        catch (Exception e)
        {
            throw new MessagingException(MessageFactory.createStaticMessage("Unable to fetch access token"),
                event, e);
        }
        return event;
    }
View Full Code Here

        {
            removeEventGroup(group);
        }
        catch (ObjectStoreException e)
        {
            throw new MessagingException(group.getMessageCollectionEvent(), e);
        }

        if (isFailOnTimeout())
        {
            MuleMessageCollection messageCollection;
            try
            {
                messageCollection = group.toMessageCollection();
            }
            catch (ObjectStoreException e)
            {
                throw new MessagingException(group.getMessageCollectionEvent(), e);
            }
            muleContext.fireNotification(new RoutingNotification(messageCollection, null,
                                                                 RoutingNotification.CORRELATION_TIMEOUT));
            MuleEvent groupCollectionEvent = group.getMessageCollectionEvent();
            try
            {
                group.clear();
            }
            catch (ObjectStoreException e)
            {
                logger.warn("Failed to clear group with id " + group.getGroupId()
                            + " since underlying ObjectStore threw Exception:" + e.getMessage());
            }
            throw new CorrelationTimeoutException(CoreMessages.correlationTimedOut(group.getGroupId()),
                                                  groupCollectionEvent);
        }
        else
        {
            if (logger.isDebugEnabled())
            {
                logger.debug(MessageFormat.format(
                        "Aggregator expired, but ''failOnTimeOut'' is false. Forwarding {0} events out of {1} "
                        + "total for group ID: {2}", group.size(), group.expectedSize(),
                        group.getGroupId()));
            }

            try
            {
                if (!(group.getCreated() + groupTimeToLive < System.currentTimeMillis()))
                {
                    MuleEvent newEvent = callback.aggregateEvents(group);
                    group.clear();
                    newEvent.getMessage().setCorrelationId(group.getGroupId().toString());

                    if (!expiredAndDispatchedGroups.contains((Serializable) group.getGroupId()))
                    {
                        // TODO which use cases would need a sync reply event
                        // returned?
                        if (timeoutMessageProcessor != null)
                        {
                            timeoutMessageProcessor.process(newEvent);
                        }
                        else
                        {
                            final FlowConstruct service = group.toArray(false)[0].getFlowConstruct();
                            if (!(service instanceof Service))
                            {
                                throw new UnsupportedOperationException(
                                        "EventAggregator is only supported with Service");
                            }

                            ((Service) service).dispatchEvent(newEvent);
                        }
                        expiredAndDispatchedGroups.store((Serializable) group.getGroupId(),
                                                         group.getCreated());
                    }
                    else
                    {
                        logger.warn(MessageFormat.format("Discarding group {0}", group.getGroupId()));
                    }
                }
            }
            catch (MessagingException me)
            {
                throw me;
            }
            catch (Exception e)
            {
                throw new MessagingException(group.getMessageCollectionEvent(), e);
            }
        }
    }
View Full Code Here

        MessageProcessor next = new MessageProcessor()
        {
            public MuleEvent process(MuleEvent event) throws MuleException
            {
                throw new MessagingException(event, null);
            }
        };

        messageProcessor.setListener(next);
View Full Code Here

                {
                    field = this.getClass().getDeclaredField(parameter.getName());
                }
                catch (NoSuchFieldException e)
                {
                    throw new MessagingException(CoreMessages.createStaticMessage(String.format(
                        "Code generation error. Field %s should be present in class", parameter.getName())),
                        event, e);
                }

                field.setAccessible(true);
View Full Code Here

            message.removeProperty(OAuthProperties.HTTP_STATUS, PropertyScope.OUTBOUND);
            message.removeProperty(OAuthProperties.CALLBACK_LOCATION, PropertyScope.OUTBOUND);
        }
        catch (Exception e)
        {
            throw new MessagingException(MessageFactory.createStaticMessage("Unable to fetch access token"),
                event, e);
        }

        return restoredEvent;
    }
View Full Code Here

TOP

Related Classes of org.mule.api.MessagingException

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.