我有一個小駱駝航線它只是將消息轉發到另一個隊列的到期時間是這樣的:建立隊列策略不發送過期的消息死信隊列駱駝端點
@Override
public void configure() throws Exception {
defaultOnException();
// Route all messages generated by system A (in OUTBOUND_A) to system B (INBOUND_B)
// @formatter:off
from("activemq:queue:OUTBOUND_A")
// ASpecificProcessor transform the coming message to another one.
.processor(new ASpecificProcessor())
.to("activemq:INBOUND_B?explicitQosEnabled=true&timeToLive={{b.inbound.message.ttl}}");
// @formatter:on
}
我需要在INBOUND_B
中發佈的消息將保持不變,默認情況下,過期消息在過期後將轉至ActiveMQ.DLQ
隊列。
我知道我可以修改conf/activemq.xml
的ActiveMQ的配置與
<policyEntry queue="INBOUND_B">
<!--
Tell the dead letter strategy not to process expired messages
so that they will just be discarded instead of being sent to
the DLQ
-->
<deadLetterStrategy>
<sharedDeadLetterStrategy processExpired="false" />
</deadLetterStrategy>
</policyEntry>
但我寧願不要改變ActiveMQ的配置(因爲它需要重新啓動),我想知道是否可以發送通過駱駝端點配置的這種策略?
也許作爲一個骯髒的解決方法,你可以啓動一條從你的DLQ消耗的小路徑,然後只記錄它們? –
不是真的,因爲可以在另一個隊列中發佈相同類型的消息(相同的主體和標頭),我希望他們留在DLQ中。從DLQ消息中,我無法看到它從哪個隊列過期。 –
繼續使用骯髒的解決方法,您實際上可以看到郵件來自何處,只會消耗您認爲合適的郵件。這就是所謂的JMS Selector: from(「activemq:DLQ?selector =」+ java.net.URLEncoder.encode(「HEADER ='VALUE'」,「UTF-8」))。(「log:discard」) ; –