• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #423

06 Nov 2026 07:16PM UTC coverage: 71.446% (+0.4%) from 71.002%
#423

push

github

web-flow
feat: external storage for activity and schedule clients (#3193)

8486 of 13953 branches covered (60.82%)

Branch coverage included in aggregate %.

70 of 78 new or added lines in 10 files covered. (89.74%)

18 existing lines in 5 files now uncovered.

33796 of 45227 relevant lines covered (74.73%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.78
/temporal-sdk/src/main/java/io/temporal/client/ActivityClientOptions.java
1
package io.temporal.client;
2

3
import io.temporal.common.Experimental;
4
import io.temporal.common.context.ContextPropagator;
5
import io.temporal.common.converter.DataConverter;
6
import io.temporal.common.converter.GlobalDataConverter;
7
import io.temporal.common.interceptors.ActivityClientInterceptor;
8
import io.temporal.payload.storage.ExternalStorage;
9
import java.lang.management.ManagementFactory;
10
import java.util.Collections;
11
import java.util.List;
12
import java.util.Objects;
13
import javax.annotation.Nullable;
14

15
/** Options for {@link ActivityClient} configuration. */
16
public final class ActivityClientOptions {
17

18
  public static ActivityClientOptions.Builder newBuilder() {
19
    return new ActivityClientOptions.Builder();
1 ✔
20
  }
21

22
  public static ActivityClientOptions.Builder newBuilder(ActivityClientOptions options) {
23
    return new ActivityClientOptions.Builder(options);
1 ✔
24
  }
25

26
  public static ActivityClientOptions getDefaultInstance() {
27
    return DEFAULT_INSTANCE;
1 ✔
28
  }
29

30
  public ActivityClientOptions.Builder toBuilder() {
31
    return new ActivityClientOptions.Builder(this);
1 ✔
32
  }
33

34
  private static final ActivityClientOptions DEFAULT_INSTANCE;
35

36
  static {
37
    DEFAULT_INSTANCE = ActivityClientOptions.newBuilder().build();
1 ✔
38
  }
1 ✔
39

40
  public static final class Builder {
41
    private static final String DEFAULT_NAMESPACE = "default";
42
    private static final List<ContextPropagator> EMPTY_CONTEXT_PROPAGATORS =
43
        Collections.emptyList();
1 ✔
44
    private static final List<ActivityClientInterceptor> EMPTY_INTERCEPTORS =
1 ✔
45
        Collections.emptyList();
1 ✔
46

47
    private String namespace;
48
    private DataConverter dataConverter;
49
    private String identity;
50
    private List<ContextPropagator> contextPropagators;
51
    private List<ActivityClientInterceptor> interceptors;
52
    private ExternalStorage externalStorage;
53

54
    private Builder() {}
55

56
    private Builder(ActivityClientOptions options) {
1 ✔
57
      if (options == null) {
1 !
58
        return;
×
59
      }
60
      namespace = options.namespace;
1 ✔
61
      dataConverter = options.dataConverter;
1 ✔
62
      identity = options.identity;
1 ✔
63
      contextPropagators = options.contextPropagators;
1 ✔
64
      interceptors = options.interceptors;
1 ✔
65
      externalStorage = options.externalStorage;
1 ✔
66
    }
1 ✔
67

68
    /** Set the namespace this client will operate on. */
69
    public Builder setNamespace(String namespace) {
70
      this.namespace = namespace;
1 ✔
71
      return this;
1 ✔
72
    }
73

74
    /**
75
     * Overrides a data converter implementation used to serialize workflow arguments and results.
76
     *
77
     * <p>Default is {@link DataConverter#getDefaultInstance()}.
78
     */
79
    public Builder setDataConverter(DataConverter dataConverter) {
80
      this.dataConverter = dataConverter;
1 ✔
81
      return this;
1 ✔
82
    }
83

84
    /** Override human-readable identity of the client. */
85
    public Builder setIdentity(String identity) {
86
      this.identity = identity;
1 ✔
87
      return this;
1 ✔
88
    }
89

90
    /**
91
     * Set the context propagators for this client.
92
     *
93
     * @param contextPropagators specifies the list of context propagators to use with the client.
94
     */
95
    public Builder setContextPropagators(List<ContextPropagator> contextPropagators) {
96
      this.contextPropagators = contextPropagators;
1 ✔
97
      return this;
1 ✔
98
    }
99

100
    /**
101
     * Set the interceptors for this client.
102
     *
103
     * @param interceptors specifies the list of interceptors to use with the client.
104
     */
105
    public Builder setInterceptors(List<ActivityClientInterceptor> interceptors) {
106
      this.interceptors = interceptors;
1 ✔
107
      return this;
1 ✔
108
    }
109

110
    /**
111
     * External storage configuration used to store/retrieve large payloads.
112
     *
113
     * <p>Defaults to null.
114
     */
115
    @Experimental
116
    public Builder setExternalStorage(@Nullable ExternalStorage externalStorage) {
117
      this.externalStorage = externalStorage;
1 ✔
118
      return this;
1 ✔
119
    }
120

121
    public ActivityClientOptions build() {
122
      String name = identity == null ? ManagementFactory.getRuntimeMXBean().getName() : identity;
1 ✔
123
      return new ActivityClientOptions(
1 ✔
124
          namespace == null ? DEFAULT_NAMESPACE : namespace,
1 ✔
125
          dataConverter == null ? GlobalDataConverter.get() : dataConverter,
1 ✔
126
          name,
127
          contextPropagators == null ? EMPTY_CONTEXT_PROPAGATORS : contextPropagators,
1 ✔
128
          interceptors == null ? EMPTY_INTERCEPTORS : interceptors,
1 ✔
129
          externalStorage);
130
    }
131
  }
132

133
  private final String namespace;
134
  private final DataConverter dataConverter;
135
  private final String identity;
136
  private final List<ContextPropagator> contextPropagators;
137
  private final List<ActivityClientInterceptor> interceptors;
138
  private final @Nullable ExternalStorage externalStorage;
139

140
  private ActivityClientOptions(
141
      String namespace,
142
      DataConverter dataConverter,
143
      String identity,
144
      List<ContextPropagator> contextPropagators,
145
      List<ActivityClientInterceptor> interceptors,
146
      @Nullable ExternalStorage externalStorage) {
1 ✔
147
    this.namespace = namespace;
1 ✔
148
    this.dataConverter = dataConverter;
1 ✔
149
    this.identity = identity;
1 ✔
150
    this.contextPropagators = contextPropagators;
1 ✔
151
    this.interceptors = interceptors;
1 ✔
152
    this.externalStorage = externalStorage;
1 ✔
153
  }
1 ✔
154

155
  /**
156
   * Get the namespace this client will operate on.
157
   *
158
   * @return Client namespace
159
   */
160
  public String getNamespace() {
161
    return namespace;
1 ✔
162
  }
163

164
  /**
165
   * Get the data converters of this client.
166
   *
167
   * @return The data converter to use with the client.
168
   */
169
  public DataConverter getDataConverter() {
170
    return dataConverter;
1 ✔
171
  }
172

173
  /**
174
   * Get the human-readable identity of the client.
175
   *
176
   * @return The identity of the client used on some requests.
177
   */
178
  public String getIdentity() {
179
    return identity;
1 ✔
180
  }
181

182
  /**
183
   * Get the context propagators of this client.
184
   *
185
   * @return The list of context propagators to use with the client.
186
   */
187
  public List<ContextPropagator> getContextPropagators() {
188
    return contextPropagators;
1 ✔
189
  }
190

191
  /**
192
   * Get the interceptors of this client.
193
   *
194
   * @return The list of interceptors to use with the client.
195
   */
196
  public List<ActivityClientInterceptor> getInterceptors() {
197
    return interceptors;
1 ✔
198
  }
199

200
  /** External storage used to offload large payloads or null when disabled. */
201
  @Experimental
202
  @Nullable
203
  public ExternalStorage getExternalStorage() {
204
    return externalStorage;
1 ✔
205
  }
206

207
  @Override
208
  public boolean equals(Object o) {
209
    if (this == o) return true;
×
210
    if (!(o instanceof ActivityClientOptions)) return false;
×
211
    ActivityClientOptions that = (ActivityClientOptions) o;
×
212
    return Objects.equals(namespace, that.namespace)
×
213
        && Objects.equals(dataConverter, that.dataConverter)
×
214
        && Objects.equals(identity, that.identity)
×
215
        && Objects.equals(contextPropagators, that.contextPropagators)
×
NEW
216
        && Objects.equals(interceptors, that.interceptors)
×
NEW
217
        && Objects.equals(externalStorage, that.externalStorage);
×
218
  }
219

220
  @Override
221
  public int hashCode() {
NEW
222
    return Objects.hash(
×
223
        namespace, dataConverter, identity, contextPropagators, interceptors, externalStorage);
224
  }
225

226
  @Override
227
  public String toString() {
228
    return "ActivityClientOptions{"
×
229
        + "namespace='"
230
        + namespace
231
        + '\''
232
        + ", dataConverter="
233
        + dataConverter
234
        + ", identity='"
235
        + identity
236
        + '\''
237
        + ", contextPropagators="
238
        + contextPropagators
239
        + ", interceptors="
240
        + interceptors
241
        + ", externalStorage="
242
        + externalStorage
243
        + '}';
244
  }
245
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc