Skip to content

Commit 474f5d1

Browse files
authored
chore (thrift deprecation): remove tchannel dependency and other thrift related names (#1031)
What changed? remove tchannel dependency change thrift naming remove some thrift related tests Why? thrift deprecation How did you test it? Unit Test
1 parent c0a7fc5 commit 474f5d1

File tree

14 files changed

+60
-156
lines changed

14 files changed

+60
-156
lines changed

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@ This doc is intended for contributors to `cadence-java-client` (hopefully that's
77
## Development Environment
88

99
* Java 11 (currently, we use Java 11 to compile Java 8 code).
10-
* Thrift 0.9.3 (use [homebrew](https://formulae.brew.sh/formula/[email protected]) or [distribution](https://downloads.apache.org/thrift/0.9.3/)). Alternatively you can install with `scripts/install-thrift-locally-osx.sh`.
1110
* Gradle build tool [6.x](https://github.com/uber/cadence-java-client/blob/master/gradle/wrapper/gradle-wrapper.properties)
1211
* Docker
1312

14-
:warning: Note 1: You must install the 0.9.x version of Thrift. Otherwise compiling would fail at error `error: package org.apache.thrift.annotation does not exist`
15-
16-
:warning: Note 2: It's currently compatible with Java 8 compiler but no guarantee in the future.
13+
:warning: Note 1: It's currently compatible with Java 8 compiler but no guarantee in the future.
1714

1815
## IntelliJ IDE integration (Optional)
1916

2017
* Make sure you set the gradle path with the right version ([currently 6.x](https://github.com/uber/cadence-java-client/blob/master/gradle/wrapper/gradle-wrapper.properties))
2118

2219
![IntelliJ](https://user-images.githubusercontent.com/4523955/135696878-81c1e62e-eb04-45e6-9bcb-785ac38b6607.png)
2320

24-
* Then all the below `gradlew` command can be replaced with the Gradle plugin operation
21+
* Then all the below `gradlew` command can be replaced with the Gradle plugin operation
2522
![Gradle](https://user-images.githubusercontent.com/4523955/135696922-d43bc36d-18a4-4b7b-adee-0fe8300bf855.png)
2623

2724
## Licence headers
@@ -61,24 +58,24 @@ Comment out the first section in `publications` ( line 160 to line 191 in [this
6158
2. Change the [version](https://github.com/uber/cadence-java-client/blob/c9ec6786aa9f866b0310292ea3ee5df63adc8799/build.gradle#L43) to add a `local` suffix. E.g.
6259
```
6360
version = '3.3.0'
64-
````
65-
to
61+
````
62+
to
6663
```
6764
version = '3.3.0-local'
68-
```
65+
```
6966
Then run the command
7067
```bash
7168
./gradlew publishToMavenLocal
7269
```
7370
Now you have the local cadence-java-client in your machine using veriosn `3.3.0-local`
7471

7572
3. To test with Cadence Java Samples, [change](https://github.com/uber/cadence-java-samples/blob/master/build.gradle#L32) `mavenCentral()` to `mavenLocal()`
76-
and also change the [version](https://github.com/uber/cadence-java-samples/blob/a79d8d6e5860cf9986bf549fc1f96badecb09f8f/build.gradle#L38) with your suffix.
73+
and also change the [version](https://github.com/uber/cadence-java-samples/blob/a79d8d6e5860cf9986bf549fc1f96badecb09f8f/build.gradle#L38) with your suffix.
7774

78-
Then `./gradlew build` and refer to the sample repo for how to run the code(it needs to run with a [Cadence server](https://github.com/uber/cadence)).
75+
Then `./gradlew build` and refer to the sample repo for how to run the code(it needs to run with a [Cadence server](https://github.com/uber/cadence)).
7976

80-
:warning: If you run into problem with `version.properties` [creation task](https://github.com/uber/cadence-java-client/blob/c9ec6786aa9f866b0310292ea3ee5df63adc8799/build.gradle#L109), you can comment the task out. It's okay for local testing.
81-
The property file is being used by [Version class](https://github.com/uber/cadence-java-client/blob/master/src/main/java/com/uber/cadence/internal/Version.java#L39)to report the library version for logging/metrics.
77+
:warning: If you run into problem with `version.properties` [creation task](https://github.com/uber/cadence-java-client/blob/c9ec6786aa9f866b0310292ea3ee5df63adc8799/build.gradle#L109), you can comment the task out. It's okay for local testing.
78+
The property file is being used by [Version class](https://github.com/uber/cadence-java-client/blob/master/src/main/java/com/uber/cadence/internal/Version.java#L39)to report the library version for logging/metrics.
8279

8380
## Unit & Integration Test
8481

@@ -92,10 +89,10 @@ The test by default will run with TestEnvironment without Cadence service. If yo
9289
```bash
9390
USE_DOCKER_SERVICE=true ./gradlew test
9491
```
95-
And sometimes it's important to test the non-sticky mode
92+
And sometimes it's important to test the non-sticky mode
9693
```bash
9794
STICKY_OFF=true USE_DOCKER_SERVICE=true ./gradlew test
9895
```
9996

100-
Also, if there is any Github Actions test failure that you cannot reproduce locally,
97+
Also, if there is any Github Actions test failure that you cannot reproduce locally,
10198
follow [github action docker-compose](./docker/github_actions/README.md) instructions to run the tests.

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ dependencies {
7373
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
7474
errorprone('com.google.errorprone:error_prone_core:2.3.4')
7575

76-
compile group: 'com.uber.tchannel', name: 'tchannel-core', version: '0.8.30'
76+
compile group: 'io.opentracing', name: 'opentracing-api', version: '0.33.0'
77+
compile group: 'io.opentracing', name: 'opentracing-util', version: '0.33.0'
7778
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
7879
compile group: 'com.google.code.gson', name: 'gson', version: '2.10'
7980
compile group: 'com.uber.m3', name: 'tally-core', version: '0.11.1'

src/main/java/com/uber/cadence/internal/external/GenericWorkflowClientExternalImpl.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,17 @@ private StartWorkflowExecutionRequest getStartRequest(
255255
if (!Strings.isNullOrEmpty(startParameters.getCronSchedule())) {
256256
request.setCronSchedule(startParameters.getCronSchedule());
257257
}
258-
request.setMemo(toMemoThrift(startParameters.getMemo()));
259-
request.setSearchAttributes(toSearchAttributesThrift(startParameters.getSearchAttributes()));
260-
request.setHeader(toHeaderThrift(startParameters.getContext()));
258+
request.setMemo(toMemo(startParameters.getMemo()));
259+
request.setSearchAttributes(toSearchAttributes(startParameters.getSearchAttributes()));
260+
request.setHeader(toHeader(startParameters.getContext()));
261261
if (startParameters.getDelayStart() != null) {
262262
request.setDelayStartSeconds((int) startParameters.getDelayStart().getSeconds());
263263
}
264264

265265
return request;
266266
}
267267

268-
private Memo toMemoThrift(Map<String, byte[]> memo) {
268+
private Memo toMemo(Map<String, byte[]> memo) {
269269
if (memo == null || memo.isEmpty()) {
270270
return null;
271271
}
@@ -274,12 +274,12 @@ private Memo toMemoThrift(Map<String, byte[]> memo) {
274274
for (Map.Entry<String, byte[]> item : memo.entrySet()) {
275275
fields.put(item.getKey(), item.getValue());
276276
}
277-
Memo memoThrift = new Memo();
278-
memoThrift.setFields(fields);
279-
return memoThrift;
277+
Memo memoEntity = new Memo();
278+
memoEntity.setFields(fields);
279+
return memoEntity;
280280
}
281281

282-
private SearchAttributes toSearchAttributesThrift(Map<String, byte[]> searchAttributes) {
282+
private SearchAttributes toSearchAttributes(Map<String, byte[]> searchAttributes) {
283283
if (searchAttributes == null || searchAttributes.isEmpty()) {
284284
return null;
285285
}
@@ -288,22 +288,22 @@ private SearchAttributes toSearchAttributesThrift(Map<String, byte[]> searchAttr
288288
for (Map.Entry<String, byte[]> item : searchAttributes.entrySet()) {
289289
fields.put(item.getKey(), item.getValue());
290290
}
291-
SearchAttributes searchAttrThrift = new SearchAttributes();
292-
searchAttrThrift.setIndexedFields(fields);
293-
return searchAttrThrift;
291+
SearchAttributes searchAttrEntity = new SearchAttributes();
292+
searchAttrEntity.setIndexedFields(fields);
293+
return searchAttrEntity;
294294
}
295295

296-
private Header toHeaderThrift(Map<String, byte[]> headers) {
296+
private Header toHeader(Map<String, byte[]> headers) {
297297
if (headers == null || headers.isEmpty()) {
298298
return null;
299299
}
300300
Map<String, byte[]> fields = new HashMap<>();
301301
for (Map.Entry<String, byte[]> item : headers.entrySet()) {
302302
fields.put(item.getKey(), item.getValue());
303303
}
304-
Header headerThrift = new Header();
305-
headerThrift.setFields(fields);
306-
return headerThrift;
304+
Header headerEntity = new Header();
305+
headerEntity.setFields(fields);
306+
return headerEntity;
307307
}
308308

309309
private RetryPolicy toRetryPolicy(RetryParameters retryParameters) {

src/main/java/com/uber/cadence/internal/replay/ActivityDecisionContext.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Consumer<Exception> scheduleActivityTask(
122122
attributes.setRetryPolicy(retryParameters.toRetryPolicy());
123123
}
124124

125-
attributes.setHeader(toHeaderThrift(parameters.getContext()));
125+
attributes.setHeader(toHeader(parameters.getContext()));
126126

127127
long scheduledEventId = decisions.scheduleActivityTask(attributes);
128128
context.setCompletionHandle(callback);
@@ -200,16 +200,16 @@ void handleActivityTaskTimedOut(HistoryEvent event) {
200200
}
201201
}
202202

203-
private Header toHeaderThrift(Map<String, byte[]> headers) {
203+
private Header toHeader(Map<String, byte[]> headers) {
204204
if (headers == null || headers.isEmpty()) {
205205
return null;
206206
}
207207
Map<String, byte[]> fields = new HashMap<>();
208208
for (Map.Entry<String, byte[]> item : headers.entrySet()) {
209209
fields.put(item.getKey(), item.getValue());
210210
}
211-
Header headerThrift = new Header();
212-
headerThrift.setFields(fields);
213-
return headerThrift;
211+
Header headerEntity = new Header();
212+
headerEntity.setFields(fields);
213+
return headerEntity;
214214
}
215215
}

src/main/java/com/uber/cadence/internal/replay/WorkflowDecisionContext.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Consumer<Exception> startChildWorkflow(
146146
attributes.setCronSchedule(parameters.getCronSchedule());
147147
}
148148

149-
attributes.setHeader(toHeaderThrift(parameters.getContext()));
149+
attributes.setHeader(toHeader(parameters.getContext()));
150150

151151
ParentClosePolicy parentClosePolicy = parameters.getParentClosePolicy();
152152
if (parentClosePolicy != null) {
@@ -172,17 +172,17 @@ Consumer<Exception> startChildWorkflow(
172172
return new ChildWorkflowCancellationHandler(initiatedEventId, attributes.getWorkflowId());
173173
}
174174

175-
private Header toHeaderThrift(Map<String, byte[]> headers) {
175+
private Header toHeader(Map<String, byte[]> headers) {
176176
if (headers == null || headers.isEmpty()) {
177177
return null;
178178
}
179179
Map<String, byte[]> fields = new HashMap<>();
180180
for (Map.Entry<String, byte[]> item : headers.entrySet()) {
181181
fields.put(item.getKey(), item.getValue());
182182
}
183-
Header headerThrift = new Header();
184-
headerThrift.setFields(fields);
185-
return headerThrift;
183+
Header headerEntity = new Header();
184+
headerEntity.setFields(fields);
185+
return headerEntity;
186186
}
187187

188188
boolean isChildWorkflowExecutionStartedWithRetryOptions() {

src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected WorkflowExecutionHistory getFullHistory(String domain, WorkflowExecuti
179179
RpcRetryer.DEFAULT_RPC_RETRY_OPTIONS,
180180
() ->
181181
WorkflowExecutionUtils.getHistoryPage(
182-
nextPageToken, this.serviceClient, domain, execution.toThrift()));
182+
nextPageToken, this.serviceClient, domain, execution.toEntity()));
183183
pageToken = resp.getNextPageToken();
184184

185185
// TODO support raw history feature once server removes default Thrift encoding

src/main/java/com/uber/cadence/internal/shadowing/WorkflowExecution.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void setRunId(String runId) {
5151
this.runId = runId;
5252
}
5353

54-
public com.uber.cadence.WorkflowExecution toThrift() {
54+
public com.uber.cadence.WorkflowExecution toEntity() {
5555
return new com.uber.cadence.WorkflowExecution().setWorkflowId(workflowId).setRunId(runId);
5656
}
5757

src/main/java/com/uber/cadence/serviceclient/ClientOptions.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ClientOptions {
4747

4848
private static final String DEFAULT_CLIENT_APP_NAME = "cadence-client";
4949

50-
/** Name of the Cadence service front end as required by TChannel. */
50+
/** Name of the Cadence service front end. */
5151
private static final String DEFAULT_SERVICE_NAME = "cadence-frontend";
5252

5353
private static final ClientOptions DEFAULT_INSTANCE;
@@ -59,23 +59,23 @@ public class ClientOptions {
5959
private final String host;
6060
private final int port;
6161
private final ManagedChannel gRPCChannel;
62-
/** The tChannel timeout in milliseconds */
62+
/** The timeout in milliseconds */
6363
private final long rpcTimeoutMillis;
64-
/** The tChannel timeout for long poll calls in milliseconds */
64+
/** The ttimeout for long poll calls in milliseconds */
6565
private final long rpcLongPollTimeoutMillis;
66-
/** The tChannel timeout for query workflow call in milliseconds */
66+
/** The timeout for query workflow call in milliseconds */
6767
private final long rpcQueryTimeoutMillis;
68-
/** The tChannel timeout for list archived workflow call in milliseconds */
68+
/** The timeout for list archived workflow call in milliseconds */
6969
private final long rpcListArchivedWorkflowTimeoutMillis;
70-
/** TChannel service name that the Cadence service was started with. */
70+
/** Grpc Service name that the Cadence service was started with. */
7171
private final String serviceName;
7272
/** Name of the service using the cadence-client. */
7373
private final String clientAppName;
7474
/** Client for metrics reporting. */
7575
private final Scope metricsScope;
76-
/** Optional TChannel transport headers */
76+
/** Optional transport headers */
7777
private final Map<String, String> transportHeaders;
78-
/** Optional TChannel headers */
78+
/** Optional headers */
7979
private final Map<String, String> headers;
8080
/** Optional authorization provider */
8181
private final IAuthorizationProvider authProvider;
@@ -320,8 +320,8 @@ public Builder setFeatureFlags(FeatureFlags featureFlags) {
320320
/**
321321
* Sets the client application name.
322322
*
323-
* <p>This name will be used as the tchannel client service name. It will also be reported as a
324-
* tag along with metrics emitted to m3.
323+
* <p>This name will be used as the client service name. It will also be reported as a tag along
324+
* with metrics emitted to m3.
325325
*
326326
* @param clientAppName String representing the client application name.
327327
* @return Builder for ClentOptions
@@ -354,7 +354,7 @@ public Builder setMetricsScope(Scope metricsScope) {
354354
}
355355

356356
/**
357-
* Sets additional transport headers for tchannel client.
357+
* Sets additional transport headers for client.
358358
*
359359
* @param transportHeaders Map with additional transport headers
360360
* @return Builder for ClentOptions

0 commit comments

Comments
 (0)