没有收到回复 - 可能是模板中的超时?

时间:2015-02-20 09:18:33

标签: spring-amqp

我已经完成了针对RPC调用的RabbitMQ-Spring配置

以下是配置: -

/>

<rabbit:queue name="identity.queue" />   
<rabbit:direct-exchange name="identity.exchange">
    <rabbit:bindings>
        <rabbit:binding queue="identity.queue"  key="identity.binding"/>
    </rabbit:bindings>
</rabbit:direct-exchange>
<bean id="idenityListener"
    class="org.springframework.amqp.remoting.service.AmqpInvokerServiceExporter">
    <property name="serviceInterface" value="<<package>.AA" />
    <property name="service" ref="AAProxy" />
    <property name="amqpTemplate" ref="template" />
</bean>

<rabbit:listener-container connection-factory="connectionFactory">
    <rabbit:listener ref="idenityListener" queue-names="identity.queue" />
</rabbit:listener-container>

At client side:-

/>

<bean id="identityClient"
    class="org.springframework.amqp.remoting.client.AmqpProxyFactoryBean">
    <property name="amqpTemplate" ref="identityTemplate" />
    <property name="serviceInterface" value="<<package>.AA" />
</bean>

<bean id="AAProxy" class="<xx>.AAProxy" init-method="init" />

<rabbit:template id="identityTemplate" connection-factory="connectionFactory" reply-timeout="2000"
    routing-key="identity.binding" exchange="identity.exchange" />

在设置RabbitMQ RPC调用时出现以下错误。此设置在同一台机器上工作,但不能在不同的机器上工作: -

    Caused by: org.springframework.remoting.RemoteProxyFailureException: No reply received - perhaps a timeout in the template?
            at org.springframework.amqp.remoting.client.AmqpClientInterceptor.invoke(AmqpClientInterceptor.java:60)  


**Log file:-**  

    =ERROR REPORT==== 19-Feb-2015::10:05:59 ===
    Channel error on connection <0.1474.0> (172.16.206.139:59826 -> 172.16.206.154:5672, vhost: '/', user: 'reetesh'), channel 13:
    {amqp_error,not_found,"no queue 'identity.queue' in vhost '/'",
                'queue.declare'}    

Whenever I tried to connect I found following above in log.   



Reetesh

1 个答案:

答案 0 :(得分:0)

我有类似的问题,我没有解决它们。最后我使用&#34;直接回复&#34;

请参阅 http://docs.spring.io/spring-amqp/docs/1.4.3.BUILD-SNAPSHOT/reference/html/amqp.html 3.7.1节。

使用此配置不需要固定的回复队列和&#34;回复 - 监听器&#34;不是必需的,不应该配置。