1

我有一个入站的RabbitMQ通道适配器,每天成功处理3000条消息,但偶尔我会在RabbitMQ管理控制台中看到一条未消息的消息数为1。这似乎仍然是这样。Spring Integration AMQP - 消息偶尔消失,需要超时?

我确实有一个重试尝试建议链重新尝试3次,然后通过死信路由键移动到DLQ,这对大多数异常都能正常工作。

在过去的几个星期里,没有发生的事情发生了两次,并且在其中一次我能够接受线程转储,并看到int-http:outbound-gateway调用被卡住等待http响应getStatusCode( )

我在int-amqp:inbound-channel-adapter上有一个receive-timeout =“59000”,我希望它会在超出超时的地方超时线程?

我现在注意到int-http:outbound-gateway上有一个reply-timeout属性,我应该设置它吗?

任何想法赞赏?

<int-amqp:inbound-channel-adapter id="amqpInCdbEvents" channel="eventsAMQPChannel" channel-transacted="true" transaction-manager="transactionManager" 
      queue-names="internal.events.queue" connection-factory="connectionFactory" 
      receive-timeout="59000" concurrent-consumers="${eventsAMQPChannel.concurrent-consumers}" 
      advice-chain="retryChain" auto-startup="false" /> 

    <int:channel id="eventsAMQPChannel" /> 

    <!-- CHAIN of processing for Asynch Processing of Events from intermediate Queue --> 
    <int:chain id="routeEventChain" input-channel="eventsAMQPChannel"> 
      <int:json-to-object-transformer type="xx.xx.xx.json.Event" object-mapper="springJacksonObjectMapper"/> 
      <int:header-enricher> 
        <int:header name="originalPayload" expression="payload" overwrite="true"/> 
        <int:header name="message_id"  expression="payload.id" overwrite="true"/> 
      </int:header-enricher> 
      <int:router expression="payload.eventType"> 
       <int:mapping value="VALUE"    channel="valueEventChannel"/> 
       <int:mapping value="SWAP"    channel="swapEventChannel"/> 
      </int:router> 
    </int:chain> 

    <int:channel id="valueEventChannel" /> 
    <int:channel id="swapEventChannel" /> 

    <int:chain id="valueEventChain" input-channel="valueEventChannel" output-channel="nullChannel"> 
      <int:transformer ref="syncValuationTransformer" /> 
      <int:object-to-json-transformer object-mapper="springJacksonObjectMapper" /> 
      <int:header-enricher> 
        <int:header name="contentType" value="application/json;charset=UTF-8" overwrite="true"/> 
      </int:header-enricher>     
      <int-http:outbound-gateway id="httpOutboundGatewayValuationServiceFinalValuation"               
        expected-response-type="java.lang.String" 
        http-method="POST"  charset="UTF-8" 
        extract-request-payload="true"           
        url="${value.service.uri}/value"/> 
    </int:chain> 
+0

我尝试添加回复超时属性为int-HTTP:30000出站网关,然后设置一个其中有一个长时间休眠HTTP端点的存根实现,而无论是reply-超时也不是接收超时=“5 9000“上的int-amqp:入站通道适配器似乎停止http调用,如果它需要太长时间 – Pete

回答

0

reply-timeout发送时的回复的回复信道( - 例如这是充分的有界队列信道,如果它可以阻止)是一个超时。

INT-HTTP:出站网关的呼叫被卡住等待HTTP响应getStatusCode()

您可以设定一个ClientHttpRequestFactory客户端超时(readtimeout),可以配置成出站适配器。 ..

/** 
* Create a new instance of the {@link RestTemplate} based on the given {@link ClientHttpRequestFactory}. 
* @param requestFactory HTTP request factory to use 
* @see org.springframework.http.client.SimpleClientHttpRequestFactory 
* @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory 
*/ 
public RestTemplate(ClientHttpRequestFactory requestFactory) { 
    this(); 
    setRequestFactory(requestFactory); 
} 
+0

谢谢加里,我添加了' ' – Pete