2016-04-15 20 views

答えて

1

これは不可能です。遅い処理交換がある場合は、より高いタイムアウトを設定する必要があるかもしれません。

このようなonTimeoutイベントのフックを見つけて、それをキャメル・ブーティーでサポートするために必要なものがあるかどうかは、Jetty APIを参照してください。

+0

今のところ解決策がありますが、調整が必要です。あなたは私の提案を以下に見て、それがラクダ桟橋に入る可能性があるかどうかを評価するかもしれません。 – micfra

+2

これは良い解決策のようです。私はこれに関するチケットを記録している:https://issues.apache.org/jira/browse/CAMEL-10175。これをそのままの状態で実装するには、パッチ/ PRで作業してください。 –

2

私はこのような私のコードでErrorHandlingHttpBindingというカスタムHttpBindingとの組み合わせで、この

if (continuation.isExpired()) { 
    String id = (String) continuation.getAttribute(EXCHANGE_ATTRIBUTE_ID); 
    // remember this id as expired 
    expiredExchanges.put(id, id); 
    log.warn("Continuation expired of exchangeId: {}", id); 

    consumer.getBinding().doWriteExceptionResponse(new TimeoutException(), response); 

    return; 
} 

ようif (continuation.isExpired())ブロックでCamelContinuationServletを変更することによって、私のプロジェクトでは、それが利用可能になったので、私はちょうどその上で私のノートを追加します

public class ErrorHandlingHttpBinding extends DefaultHttpBinding { 

    @Override 
    public void doWriteExceptionResponse(Throwable exception, HttpServletResponse response) throws IOException { 
    if (exception instanceof TimeoutException) { 
     response.setStatus(HttpServletResponse.SC_GATEWAY_TIMEOUT); 
     response.getWriter().write("Continuation timed out...");    
    } else { 
     super.doWriteExceptionResponse(exception, response); 
    } 
    } 
} 

id="errorHandlingHttpBinding"とスプリングBeanとして登録さjetty:http://localhost:21010/?useContinuation=true&continuationTimeout=1&httpBindingRef=errorHandlingHttpBindingとして成分ストリングにいいます。

関連する問題