⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multicastingrouter.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: MulticastingRouter.java 13006 2008-10-09 20:32:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.routing.outbound;import org.mule.DefaultMuleMessage;import org.mule.api.MuleException;import org.mule.api.MuleMessage;import org.mule.api.MuleSession;import org.mule.api.endpoint.ImmutableEndpoint;import org.mule.api.endpoint.OutboundEndpoint;import org.mule.api.routing.CouldNotRouteOutboundMessageException;import org.mule.api.routing.RoutePathNotFoundException;import org.mule.api.routing.RoutingException;import org.mule.config.i18n.CoreMessages;import java.util.ArrayList;import java.util.List;/** * <code>MulticastingRouter</code> will broadcast the current message to every endpoint * registed with the router. */public class MulticastingRouter extends FilteringOutboundRouter{    public MuleMessage route(MuleMessage message, MuleSession session)        throws RoutingException    {        if (endpoints == null || endpoints.size() == 0)        {            throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null);        }        if (enableCorrelation != ENABLE_CORRELATION_NEVER)        {            boolean correlationSet = message.getCorrelationId() != null;            if (correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET))            {                logger.debug("CorrelationId is already set, not setting Correlation group size");            }            else            {                // the correlationId will be set by the AbstractOutboundRouter                message.setCorrelationGroupSize(endpoints.size());            }        }        List results = new ArrayList(endpoints.size());        try        {            OutboundEndpoint endpoint;            for (int i = 0; i < endpoints.size(); i++)            {                endpoint = (OutboundEndpoint) endpoints.get(i);                if (endpoint.isSynchronous())                {                    results.add(send(session, new DefaultMuleMessage(message.getPayload(), message), endpoint));                }                else                {                    dispatch(session, message, endpoint);                }            }        }        catch (MuleException e)        {            throw new CouldNotRouteOutboundMessageException(message, (ImmutableEndpoint) endpoints.get(0), e);        }        return resultsHandler.aggregateResults(results, message);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -