Where in the application would you define the vm:endpoint for a dlqEndpoint-ref defined in an until-successful scope?

筅森魡賤 提交于 2019-12-23 03:54:08

问题


I'm trying to follow the example in this blog post (http://blogs.mulesoft.org/meet-until-successful-store-and-forward-for-mule/) for defining a dead letter queue for an until-successful scope element. This is the snippet from the blog post that doesn't quite make sense:

<vm:endpoint name="dlqChannel" path="dlq" />

<until-successful objectStore-ref="objectStore"
    dlqEndpoint-ref="dlqChannel"
    maxRetries="3"
    secondsBetweenRetries="10">
    ...
</until-successful>

I don't quite understand where the vm endpoint lives in the app. I don't think it goes in the same flow as the until-successful element. I've tried putting it in its own flow but I get a NoSuchBeanDefinitionException.

Here is my relevant code:

<flow ....>
   ....
    <until-successful objectStore-ref="objectStore" failureExpression="#[header:INBOUND:http.status != 201]" maxRetries="1" secondsBetweenRetries="5" doc:name="Until Successful" deadLetterQueue-ref="aggieFeedDestinedDeadLetterQueue">
   ....
</flow>

<flow name="edus-pubFlow1" doc:name="edus-pubFlow1">
    <vm:inbound-endpoint exchange-pattern="one-way"       path="aggieFeedDestinedDeadLetterQueue" doc:name="aggieFeedDestinedDeadLetterQueue"/>
    <logger message="DEAD DEAD DEAD LETTER LETTER LETTER #[message]" level="INFO" doc:name="Logger"/>
</flow>  

回答1:


The dlqChannel attribute refers to a global endpoint. In your case, use:

<vm:inbound-endpoint exchange-pattern="one-way"       path="aggieFeedDestinedDeadLetterQueue" />

<flow ....>
   ....
    <until-successful objectStore-ref="objectStore"
         failureExpression="#[header:INBOUND:http.status != 201]"
         maxRetries="1" secondsBetweenRetries="5"
         deadLetterQueue-ref="aggieFeedDestinedDeadLetterQueue">
   ....
</flow>

<flow name="edus-pubFlow1">
    <endpoint ref="aggieFeedDestinedDeadLetterQueue" />
    <logger message="DEAD DEAD DEAD LETTER LETTER LETTER #[message]" level="INFO" doc:name="Logger"/>
</flow>

Also if you're using Mule 3.3.0 or above, you can use MEL:

failureExpression="#[message.inboundProperties['http.status'] != 201]"


来源:https://stackoverflow.com/questions/18775121/where-in-the-application-would-you-define-the-vmendpoint-for-a-dlqendpoint-ref

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!