分散收集路由错误.消息有效内容的类型为:String

Wal*_*rry 0 mule mule-studio

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

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 ...
Run Code Online (Sandbox Code Playgroud)

从对错误的最高描述来看,我理解Scatter聚集不接收String有效负载的问题,即使该组件的当前文档没有提到任何类型.它是否正确?

我正在运行的流程非常简单,从入站http接收String并尝试将其路由到REST服务,该服务将使用String打印某些内容(返回text/plain),并将数据库存储到DB中以将其存储在表.相关代码如下:

<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"/>
Run Code Online (Sandbox Code Playgroud)

通过网络搜索我发现这个旧的Mule JIRA问题有一个类似于我得到的例外,但尝试建议的解决方案(解决方法?)没有为我做任何事情:https://www.mulesoft.org/ JIRA /浏览/ MULE-7594

Víc*_*ero 5

您的路线0中发生了错误.

您将根据文档获得复合路由异常:

CompositeRoutingException是3.5.0 Runtime的新增内容.它扩展了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>
Run Code Online (Sandbox Code Playgroud)