Spring transactions RPC模型中带有事务管理器的AMQP

Spring transactions RPC模型中带有事务管理器的AMQP,spring-transactions,spring-amqp,Spring Transactions,Spring Amqp,我正在使用springamqp/RabbitMQ进行带有RPC的项目。我能够通过MessageBroker发送和接收消息,没有任何问题 这是我的工作代码 <bean id="stbListener" class="org.springframework.amqp.remoting.service.A mqpInvokerServiceExporter"> <property name="serviceInterface" value="com.java.stb.

我正在使用springamqp/RabbitMQ进行带有RPC的项目。我能够通过MessageBroker发送和接收消息,没有任何问题

这是我的工作代码

<bean id="stbListener"
    class="org.springframework.amqp.remoting.service.A mqpInvokerServiceExporter">
    <property name="serviceInterface" value="com.java.stb.service.api.STBService" />
    <property name="service" ref="stbService" />
    <property name="amqpTemplate" ref="template" />
</bean>

<bean id="stbService" class="com.java.stb.service.impl.STBServiceImpl" />

<rabbit:connection-factory id="connectionFactory"
    channel-cache-size="10" />
<rabbit:admin connection-factory="connectionFactory"
    auto-startup="false" />
<rabbit:template id="template" connection-factory="connectionFactory"
    channel-transacted="true" />

<rabbit:queue name="${queue}" />

<rabbit:listener-container connection-factory="connectionFactory">
    <rabbit:listener ref="stbListener" queue-names="${queue}" />
</rabbit:listener-container>
我在消费者端设置了
reply timeout=“10000”

请帮我解决这个问题

先谢谢你


Gopy

我建议您在两侧打开调试日志记录;如果你不知道问题出在哪里,把日志贴到某个地方,我们可以看看

当您说您在生产者端添加了
@Transactional
时,不清楚您为什么在消费者端添加了Rabbit事务管理器

如果您的STBServiceImpl与DB对话,则事务管理器应该是JDBC事务管理器


如果希望下游
rabbitmplate
参与入站会话,则消息侦听器容器也需要
channel transactive
-否则侦听器在非事务性通道中运行。

i仅在生产者端添加了“@transactional”。现在,我尝试使用listner容器中的“org.springframework.orm.hibernate4.HibernateTransactionManager”和“channel transact=“true”。还是同一个问题,我将为您启用调试和更新。还有一件事我只在处女座服务器上面对这个问题,而不是在日食中。这是我当前的listner配置,谢谢
<bean id="stbListener"
class="org.springframework.amqp.remoting.service.A mqpInvokerServiceExporter">
<property name="serviceInterface" value="com.java.stb.service.api.STBService" />
<property name="service" ref="stbService" />
<property name="amqpTemplate" ref="template" />
</bean>


<bean id="rabbitTxManager"
class="org.springframework.amqp.rabbit.transaction .RabbitTransactionManager">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<bean id="stbService" class="com.java.stb.service.impl.STBServiceImpl" />

<rabbit:connection-factory id="connectionFactory"
channel-cache-size="10" />
<rabbit:admin connection-factory="connectionFactory"
auto-startup="false" />
<rabbit:template id="template" connection-factory="connectionFactory" 
channel-transacted="true" />

<rabbit:queue name="${queue}" />

<rabbit:listener-container concurrency="20" prefetch="20" transaction-size="10" auto-startup="false" 
connection-factory="connectionFactory" transaction-manager="rabbitTxManager">
<rabbit:listener ref="stbListener" queue-names="${queue}" />
</rabbit:listener-container> 
Caused by: org.springframework.remoting.RemoteProxyFailureExc eption: No reply received - perhaps a timeout in the template?
at org.springframework.amqp.remoting.client.AmqpClien tInterceptor.invoke(AmqpClientInterceptor.java:60)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy7.isIdentityAvailableForSTB(Un known Source)
at tv.moonweb.stb.service.api.STBServiceClient.isIden tityAvailableForSTB(STBServiceClient.java:101)
... 17 more