【发布时间】:2014-05-31 00:06:29
【问题描述】:
我有 2 个独立的 Amazon SQS 队列;队列和响应队列。
SQS 配置:
<sqs:config name="Amazon_SQS_Consumer" accessKey="XXX" secretKey="XXX" queueName="Queue" doc:name="Amazon SQS">
<sqs:connection-pooling-profile maxActive="10" maxIdle="10" exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="12000" minEvictionMillis="60000" evictionCheckIntervalMillis="30000" initialisationPolicy="INITIALISE_ONE"/>
<reconnect count="5" frequency="1000"/>
</sqs:config>
<sqs:config name="Amazon_SQS_Response" accessKey="XXX" secretKey="XXX" queueName="ResponseQueue" doc:name="Amazon SQS">
<sqs:connection-pooling-profile maxActive="100" maxIdle="10" exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="12000" minEvictionMillis="60000" evictionCheckIntervalMillis="30000" initialisationPolicy="INITIALISE_ONE"/>
<reconnect count="5" frequency="1000"/>
</sqs:config>
我通过以下方式从第一个队列(Queue)接收消息没有问题:
<flow name="consumer" doc:name="consumer">
<sqs:receive-messages config-ref="Amazon_SQS_Consumer" preserveMessages="true" doc:name="Amazon SQS (Streaming)" visibilityTimeout="300" />
<logger level="INFO" message="#[payload]" />
</flow>
我还需要接收来自第二个队列(ResponseQueue)的消息:
<flow name="response" doc:name="response">
<sqs:receive-messages config-ref="Amazon_SQS_Response" preserveMessages="true" doc:name="Amazon SQS (Streaming)" visibilityTimeout="300" />
<logger level="INFO" message="#[payload]" />
</flow>
但是,每当添加第二个 sqs:receive-messages 时,我都会收到以下错误:
Exception in thread "Receiving Thread" java.lang.LinkageError: loader (instance of org/mule/module/launcher/plugin/MulePluginsClassLoader): attempted duplicate class definition for name: "com/amazonaws/services/sqs/QueueUrlHandler"
是否可以从同一个项目中的 2 个不同队列中读取消息?
我正在使用3.4.0 CE Mule 服务器运行时和2.4.4 Amazon SQS 连接器。 我需要继续使用这些版本。如果我切换到3.5.0 EE Mule Server Runtime,拥有多个sqs:receive-messages是没有问题的;它按预期工作。但是,它leads to another issue。
【问题讨论】:
-
我应该早点问:在 Studio、Mule 或两者上运行应用程序时,您是否遇到此异常?
-
@DavidDossot Just Studio。
-
好的,人们已经报告了 Eclipse 上普通 Spring 项目的类似问题。清理项目并重建它似乎可以解决问题。
-
@DavidDossot 在使用 Mule Server Runtime
3.5.0 EE和 SQS2.5.0时,我可以接收来自 2 个队列的消息,但不能像我需要的那样在3.4.0 CE和 SQS2.4.4中接收消息。 . -
嗯,是的,SQS
2.5.0期望 Mule3.5.0(请参阅:github.com/mulesoft/sqs-connector/blob/mule-module-sqs-2.5.0/…)。我想你必须自己从源代码构建一个3.5.0 CE分发,这样你才能部署你的应用程序。
标签: mule mule-studio amazon-sqs