19

我们如何让 Pentaho 在连接错误时重试休息请求?

我们有一个 Pentaho BI 系统,在众多数据源中,它每次运行都会查询一个特定的 REST api 以获取超过 20k 的查询变体。

可以预见的是,在大多数运行中,其中一些请求将由于连接中断而失败。这些通常在 Pentaho 日志中表现为org.pentaho.di.core.exception.KettleException由于javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake,最终导致java.io.EOFException: SSL peer shut down incorrectly

在搜索了互联网和 Pentaho 论坛之后,我们找不到任何关于在这种情况下添加简单重试方法的说明。头发被扯掉了。

帮助我 StackOverflow,你是我唯一的希望!

更新 1: 堆栈跟踪:

ERROR 29-11 11:02:17,659 - B - org.pentaho.di.core.exception.KettleException:
Can not result from [https://<DOMAIN>/<PATH>?<PARAMS>]
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake    
    at org.pentaho.di.trans.steps.rest.Rest.callRest(Rest.java:190)
    at org.pentaho.di.trans.steps.rest.Rest.processRow(Rest.java:385)
    at org.pentaho.di.trans.step.RunThread.run(RunThread.java:40)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.executeMethod(DefaultApacheHttpMethodExecutor.java:213)
    at com.sun.jersey.client.apache.ApacheHttpClientHandler.handle(ApacheHttpClientHandler.java:175)
    at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:81)
    at com.sun.jersey.api.client.Client.handle(Client.java:648)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670)
    at com.sun.jersey.api.client.WebResource.get(WebResource.java:191)
    at org.pentaho.di.trans.steps.rest.Rest.callRest(Rest.java:141)
    ... 3 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:817)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:632)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:827)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.flushRequestOutputStream(MultiThreadedHttpConnectionManager.java:1525)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1975)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
    at com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.executeMethod(DefaultApacheHttpMethodExecutor.java:210)
    ... 9 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:333)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)
    ... 22 more
4

2 回答 2

1

或在休息客户端步骤上使用步骤错误处理,并将错误字段定向到另一个休息客户端步骤。

显然,这只允许您重试尽可能多的步骤,但无论如何重试一次以上是没有意义的。

于 2011-11-30T13:26:34.377 回答
0

使用来源,卢克。

在 org.pentaho.di.trans.steps.rest.Rest.processRow(Rest.java:385) 你会发现

    } catch(KettleException e) {
         boolean sendToErrorRow=false;
         String errorMessage = null;

        if (getStepMeta().isDoingErrorHandling()){
             sendToErrorRow = true;
             errorMessage = e.toString();
        } else {
            logError(BaseMessages.getString(PKG, "Rest.ErrorInStepRunning")+e.getMessage()); //$NON-NLS-1$
            setErrors(1);
            logError(Const.getStackTracker(e));
            stopAll();
            setOutputDone();  // signal end to receiver(s)
            return false;
        }

        if (sendToErrorRow) {
           // Simply add this row to the error row
           putError(getInputRowMeta(), r, 1, errorMessage, null, "Rest001");
        }

    }

看来您可以基于行配置错误处理。这似乎是你所追求的。

于 2011-11-30T10:55:40.610 回答