Skip to content

Commit 0dd15eb

Browse files
author
mike.wq
committed
feat(#proxy) : 1.2.1 release version
1 parent 0f121b4 commit 0dd15eb

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

app-stream-api/src/main/java/com/dingtalk/open/app/api/OpenDingTalkStreamClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private EndPointConnection openConnection(DingTalkCredential credential, Set<Sub
8181
request.setUa(UserAgent.getUserAgent().getUa());
8282
request.setSubscriptions(subscriptions);
8383
request.setLocalIp(IpUtils.getLocalIP());
84-
OpenConnectionResponse response = openApiClient.openConnection(request, proxy);
84+
OpenConnectionResponse response = openApiClient.openConnection(request);
8585
return new EndPointConnection(credential.getClientId(), response.getEndpoint(), response.getTicket(), proxy);
8686
}
8787

app-stream-api/src/main/java/com/dingtalk/open/app/api/open/HttpOpenApiClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ class HttpOpenApiClient implements OpenApiClient {
1818

1919
private final String host;
2020

21+
private final Proxy proxy;
22+
2123
private final int timeout;
2224

23-
public HttpOpenApiClient(String host, int timeout) {
25+
public HttpOpenApiClient(String host, int timeout, Proxy proxy) {
2426
this.host = host;
2527
this.timeout = timeout;
28+
this.proxy = proxy;
2629
}
2730

2831
@Override
29-
public OpenConnectionResponse openConnection(OpenConnectionRequest request, Proxy proxy) throws Exception {
32+
public OpenConnectionResponse openConnection(OpenConnectionRequest request) throws Exception {
3033
URL url = new URL(host + "/v1.0/gateway/connections/open");
3134

3235
HttpURLConnection connection;

app-stream-api/src/main/java/com/dingtalk/open/app/api/open/OpenApiClient.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.dingtalk.open.app.api.open;
22

3-
import java.net.Proxy;
4-
53
/**
64
* @author feiyin
75
* @date 2023/2/9
@@ -14,7 +12,7 @@ public interface OpenApiClient {
1412
* @return
1513
* @throws Exception
1614
*/
17-
OpenConnectionResponse openConnection(OpenConnectionRequest request, Proxy proxy) throws Exception;
15+
OpenConnectionResponse openConnection(OpenConnectionRequest request) throws Exception;
1816

1917

2018
}

app-stream-api/src/main/java/com/dingtalk/open/app/api/open/OpenApiClientBuilder.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.dingtalk.open.app.api.open;
22

3+
import java.net.Proxy;
4+
35
/**
46
* @author feiyin
57
* @date 2023/3/1
@@ -16,6 +18,8 @@ public static OpenApiClientBuilder create() {
1618

1719
public String host;
1820

21+
private Proxy proxy;
22+
1923
private int timeout = 3000;
2024

2125
public OpenApiClientBuilder setHost(String host) {
@@ -28,7 +32,12 @@ public OpenApiClientBuilder setTimeout(int timeout) {
2832
return this;
2933
}
3034

35+
public OpenApiClientBuilder setProxy(Proxy proxy) {
36+
this.proxy = proxy;
37+
return this;
38+
}
39+
3140
public OpenApiClient build() {
32-
return new HttpOpenApiClient(host, timeout);
41+
return new HttpOpenApiClient(host, timeout, proxy);
3342
}
3443
}

app-stream-api/src/main/java/com/dingtalk/open/app/api/protocol/AppServiceListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void receive(Context context) {
2929
try {
3030
commandDispatcher.execute(context);
3131
} catch (Exception e) {
32-
LOGGER.error("[DingTalk] dispatch command failed", e);
32+
LOGGER.error("[DingTalk] dispatch command failed, {}", e);
3333
}
3434
});
3535
}

app-stream-network/app-stream-network-core/src/main/java/com/dingtalk/open/app/stream/network/core/Connector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private static void ensureActive() {
6969
}
7070
INIT = true;
7171
} catch (Exception e) {
72-
LOGGER.error("[DingTalk] client init transport failed", e);
72+
LOGGER.error("[DingTalk] client init transport failed, {}", e);
7373
} finally {
7474
INIT_LOCK.unlock();
7575
}

app-stream-network/app-stream-network-core/src/main/java/com/dingtalk/open/app/stream/network/core/DefaultSessionPool.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.dingtalk.open.app.stream.protocol.system.SystemTopic;
99
import io.netty.util.concurrent.DefaultThreadFactory;
1010

11-
import java.net.Proxy;
1211
import java.util.Map;
1312
import java.util.concurrent.*;
1413
import java.util.concurrent.atomic.AtomicBoolean;
@@ -178,7 +177,7 @@ public void run() {
178177
}
179178
}
180179
} catch (Throwable e) {
181-
LOGGER.error("[DingTalk] establish connection failed", e);
180+
LOGGER.error("[DingTalk] establish connection failed, {}", e);
182181
}
183182
}
184183
}
@@ -202,7 +201,7 @@ public T run(Callable<T> callable) throws Exception {
202201
try {
203202
return callable.call();
204203
} catch (Exception e) {
205-
LOGGER.error("[DingTalk] retrievable executor execute failed", e);
204+
LOGGER.error("[DingTalk] retrievable executor execute failed, {}", e);
206205
if (count.get() <= 0) {
207206
throw e;
208207
}

0 commit comments

Comments
 (0)