分散收集路由错误.消息负载的类型为:字符串



我是Mule的新手,在Anypoint Studio上处理一个相当简单的Hello World示例以测试分散/收集流控制元素时,我收到以下错误,没有太多其他信息:

ERROR 2014-12-19 22:00:30,172 [[unifinesb].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message : Exception was found for route(s): 0. Message payload is of type: String
Type : org.mule.routing.CompositeRoutingException
Code : MULE_ERROR--2
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html
Payload : /Waldo
********************************************************************************
Exception stack is:
1. Exception was found for route(s): 0. Message payload is of type: String (org.mule.routing.CompositeRoutingException)
org.mule.routing.CollectAllAggregationStrategy:51 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html)
********************************************************************************
Root Exception stack trace:
org.mule.routing.CompositeRoutingException: Exception was found for route(s): 0. Message payload is of type: String
at org.mule.routing.CollectAllAggregationStrategy.aggregateWithFailedRoutes(CollectAllAggregationStrategy.java:51)
at org.mule.routing.CollectAllAggregationStrategy.aggregate(CollectAllAggregationStrategy.java:38)
at org.mule.routing.ScatterGatherRouter.processResponses(ScatterGatherRouter.java:207)
at org.mule.routing.ScatterGatherRouter.process(ScatterGatherRouter.java:135)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at ...

从错误的顶部描述来看,我理解的问题是 Scatter gather 没有收到字符串有效负载,即使该组件的当前文档没有提到此类内容。这是对的吗?

我正在运行的流程相当简单,从入站 http 接收字符串并尝试将其路由到 REST 服务,该服务将使用字符串打印某些内容(返回文本/纯文本(和数据库以将字符串存储在表中。相关代码如下:

<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" doc:name="HTTP"/>
<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Filter browser icon padding"/>
<logger message="current payload is #[payload]" level="INFO" doc:name="Startup log - to stdout"/>
<scatter-gather doc:name="Scatter-Gather">
<processor-chain>
<logger message="#['Rest branch msg input :' + payload]" level="DEBUG" doc:name="File Logger"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/application/rest/mensaje?givenName=#[payload]" doc:name="REST Service"/>
<logger message="#['Rest msg output :' + payload]" level="DEBUG" doc:name="File Logger"/>
</processor-chain>
<processor-chain>
<logger message="#['Database msg input :' + payload]" level="DEBUG" doc:name="File Logger"/>
<db:insert config-ref="MySQL_VestaLocal" doc:name="Application Postgress">
<db:parameterized-query><![CDATA[insert into http_user_info (first_name) values ('#[payload]');]]></db:parameterized-query>
</db:insert>
<logger message="#['Database msg output :' + payload]" level="DEBUG" doc:name="File Logger"/>
</processor-chain>
</scatter-gather>
<set-payload value="#['REST DB Success!']" doc:name="Set Payload"/>

在网上拖网时,我发现了这个旧的Mule JIRA问题,但有一个类似于我得到的例外,但是尝试建议的解决方案(解决方法?(对我没有任何作用:https://www.mulesoft.org/jira/browse/MULE-7594

路由 0 中出现问题。

根据文档,您会收到复合路由异常:

复合路由异常是 3.5.0 运行时的新增功能。它延伸 Mule MessagingException,用于聚合来自不同的异常 单个消息路由器上下文中的路由。例外情况是 通过顺序 ID 与每个路由相关联。

此异常公开了两种允许您获取 ID 的方法 失败的路由和每个路由返回的异常。

getExceptions 方法返回一个映射,其中键是整数 标识失败路由的索引,值为 异常本身。getExceptionForRouteIndex(int( 方法返回 请求的路由 ID 除外。

由于您没有执行策略,因此 toString 是对该异常的调用,并且只会打印路由失败(这与有效负载为 String 的事实无关(

请使用以下执行策略来找出确切的问题所在:

<catch-exception-strategy doc:name="Catch Exception Strategy">
    <logger level="ERROR" message="#[exception.exceptions]"/>
</catch-exception-strategy>

相关内容

最新更新