xref: /aosp_15_r20/external/sdk-platform-java/gax-java/README.md (revision 882aa7c72c3cd3b66e72a261bdd69b93f7de7670)
1*882aa7c7SMatt GilbrideGoogle API Extensions for Java
2*882aa7c7SMatt Gilbride==============================
3*882aa7c7SMatt Gilbride
4*882aa7c7SMatt Gilbride- [API Documentation](https://cloud.google.com/java/docs/reference/gax/latest/overview.html)
5*882aa7c7SMatt Gilbride
6*882aa7c7SMatt GilbrideGoogle API Extensions for Java (GAX Java) is a library which aids in the
7*882aa7c7SMatt Gilbridedevelopment of client libraries for server APIs, based on [GRPC](http://grpc.io)
8*882aa7c7SMatt Gilbrideand Google API conventions.
9*882aa7c7SMatt Gilbride
10*882aa7c7SMatt GilbrideApplication code will rarely need to use most of the classes within this
11*882aa7c7SMatt Gilbridelibrary directly, but code generated automatically from the API definition
12*882aa7c7SMatt Gilbridefiles can use services such as paged list iteration, request batching, and
13*882aa7c7SMatt Gilbridepolling of long-running operations to provide a more convenient and idiomatic
14*882aa7c7SMatt GilbrideAPI surface to callers.
15*882aa7c7SMatt Gilbride
16*882aa7c7SMatt GilbrideCurrently, this library shouldn't be used independently of google-cloud-java, otherwise there is
17*882aa7c7SMatt Gilbridea high risk of diamond dependency problems, because google-cloud-java uses beta features from this
18*882aa7c7SMatt Gilbridelibrary which can change in breaking ways between versions. See [VERSIONING](#versioning) for
19*882aa7c7SMatt Gilbridemore information.
20*882aa7c7SMatt Gilbride
21*882aa7c7SMatt Gilbride> For new and existing Developers/ Contributors:
22*882aa7c7SMatt Gilbride>
23*882aa7c7SMatt Gilbride> In December 2022, gax-java's build tool has been migrated from gradle to maven.
24*882aa7c7SMatt Gilbride> Gradle related files are no longer being maintained and will be eventually removed.
25*882aa7c7SMatt Gilbride>
26*882aa7c7SMatt Gilbride> The artifact coordinates in Maven Central (`{{ group_id }}:{{ artifact_id }}`) remain the same.
27*882aa7c7SMatt Gilbride
28*882aa7c7SMatt GilbrideQuickstart
29*882aa7c7SMatt Gilbride----------
30*882aa7c7SMatt Gilbride
31*882aa7c7SMatt Gilbride[//]: # ({x-version-update-start:gax:released})
32*882aa7c7SMatt GilbrideIf you are using Maven, add this to your pom.xml file
33*882aa7c7SMatt Gilbride```xml
34*882aa7c7SMatt Gilbride<dependency>
35*882aa7c7SMatt Gilbride  <groupId>com.google.api</groupId>
36*882aa7c7SMatt Gilbride  <artifactId>gax</artifactId>
37*882aa7c7SMatt Gilbride  <version>2.23.0</version>
38*882aa7c7SMatt Gilbride</dependency>
39*882aa7c7SMatt Gilbride<dependency>
40*882aa7c7SMatt Gilbride  <groupId>com.google.api</groupId>
41*882aa7c7SMatt Gilbride  <artifactId>gax-grpc</artifactId>
42*882aa7c7SMatt Gilbride  <version>2.23.0</version>
43*882aa7c7SMatt Gilbride</dependency>
44*882aa7c7SMatt Gilbride```
45*882aa7c7SMatt Gilbride
46*882aa7c7SMatt GilbrideIf you are using Gradle, add this to your dependencies
47*882aa7c7SMatt Gilbride
48*882aa7c7SMatt Gilbride```Groovy
49*882aa7c7SMatt Gilbridecompile 'com.google.api:gax:2.23.0',
50*882aa7c7SMatt Gilbride  'com.google.api:gax-grpc:2.23.0'
51*882aa7c7SMatt Gilbride```
52*882aa7c7SMatt Gilbride
53*882aa7c7SMatt GilbrideIf you are using SBT, add this to your dependencies
54*882aa7c7SMatt Gilbride
55*882aa7c7SMatt Gilbride```Scala
56*882aa7c7SMatt GilbridelibraryDependencies += "com.google.api" % "gax" % "2.23.0"
57*882aa7c7SMatt GilbridelibraryDependencies += "com.google.api" % "gax-grpc" % "2.23.0"
58*882aa7c7SMatt Gilbride```
59*882aa7c7SMatt Gilbride[//]: # ({x-version-update-end})
60*882aa7c7SMatt Gilbride
61*882aa7c7SMatt GilbrideTo find the latest version, see https://search.maven.org/artifact/com.google.api/gax.
62*882aa7c7SMatt Gilbride
63*882aa7c7SMatt GilbrideJava Versions
64*882aa7c7SMatt Gilbride-------------
65*882aa7c7SMatt Gilbride
66*882aa7c7SMatt GilbrideJava 8 or above is required for using this library.
67*882aa7c7SMatt Gilbride
68*882aa7c7SMatt GilbrideTo build this project, JDK 11 or above is required.
69*882aa7c7SMatt GilbrideThe build produces Java bytecode targeted for Java 8.
70*882aa7c7SMatt Gilbride
71*882aa7c7SMatt GilbrideThe project uses Gradle to build while it also provides Bazel build.
72*882aa7c7SMatt Gilbride
73*882aa7c7SMatt GilbrideIf you build this project in Bazel, it requires Bazel 4 and basic UNIX commands
74*882aa7c7SMatt Gilbride(e.g., `cat`).
75*882aa7c7SMatt Gilbride
76*882aa7c7SMatt GilbrideContributing
77*882aa7c7SMatt Gilbride------------
78*882aa7c7SMatt Gilbride
79*882aa7c7SMatt GilbrideContributions to this library are always welcome and highly encouraged.
80*882aa7c7SMatt Gilbride
81*882aa7c7SMatt GilbrideSee the [CONTRIBUTING] documentation for more information on how to get started.
82*882aa7c7SMatt Gilbride
83*882aa7c7SMatt GilbrideVersioning
84*882aa7c7SMatt Gilbride----------
85*882aa7c7SMatt Gilbride
86*882aa7c7SMatt GilbrideThis library follows [Semantic Versioning](http://semver.org/), but with some
87*882aa7c7SMatt Gilbrideadditional qualifications:
88*882aa7c7SMatt Gilbride
89*882aa7c7SMatt Gilbride1. Components marked with `@BetaApi` are considered to be "0.x" features inside
90*882aa7c7SMatt Gilbride   a "1.x" library. This means they can change between minor and patch releases
91*882aa7c7SMatt Gilbride   in incompatible ways. These features should not be used by any library "B"
92*882aa7c7SMatt Gilbride   that itself has consumers, unless the components of library B that use
93*882aa7c7SMatt Gilbride   `@BetaApi` features are also marked with `@BetaApi`. Features marked as
94*882aa7c7SMatt Gilbride   `@BetaApi` are on a path to eventually become "1.x" features with the marker
95*882aa7c7SMatt Gilbride   removed.
96*882aa7c7SMatt Gilbride
97*882aa7c7SMatt Gilbride   **Special exception for google-cloud-java**: google-cloud-java is
98*882aa7c7SMatt Gilbride   allowed to depend on `@BetaApi` features without declaring the consuming
99*882aa7c7SMatt Gilbride   code `@BetaApi`, because gax-java and google-cloud-java move in step
100*882aa7c7SMatt Gilbride   with each other. For this reason, gax-java should not be used
101*882aa7c7SMatt Gilbride   independently of google-cloud-java.
102*882aa7c7SMatt Gilbride
103*882aa7c7SMatt Gilbride1. Components marked with `@InternalApi` are technically public, but are only
104*882aa7c7SMatt Gilbride   public for technical reasons, because of the limitations of Java's access
105*882aa7c7SMatt Gilbride   modifiers. For the purposes of semver, they should be considered private.
106*882aa7c7SMatt Gilbride
107*882aa7c7SMatt Gilbride1. Components marked with `@InternalExtensionOnly` are stable for usage, but
108*882aa7c7SMatt Gilbride   not for extension. Thus, methods will not be removed from interfaces marked
109*882aa7c7SMatt Gilbride   with this annotation, but methods can be added, thus breaking any
110*882aa7c7SMatt Gilbride   code implementing the interface. See the javadocs for more details on other
111*882aa7c7SMatt Gilbride   consequences of this annotation.
112*882aa7c7SMatt Gilbride
113*882aa7c7SMatt Gilbride### Submodule notes
114*882aa7c7SMatt Gilbride
115*882aa7c7SMatt Gilbride- `gax` is stable (>= 1.0.0), so anything not marked `@BetaApi`, `@InternalApi`,
116*882aa7c7SMatt Gilbrideor `@InternalExtensionOnly` won't break between minor releases. Anything marked
117*882aa7c7SMatt Gilbride`@InternalExtensionOnly` can only break extensions between minor releases.
118*882aa7c7SMatt Gilbride- `gax-grpc` is stable (>= 1.0.0), so anything not marked `@BetaApi`, `@InternalApi`,
119*882aa7c7SMatt Gilbrideor `@InternalExtensionOnly` won't break between minor releases. Anything marked
120*882aa7c7SMatt Gilbride`@InternalExtensionOnly` can only break extensions between minor releases.
121*882aa7c7SMatt Gilbride- `gax-httpjson` is beta (0.x.y), so anything may change at any time and the public
122*882aa7c7SMatt GilbrideAPI should not be considered stable. There is no difference whether a class is
123*882aa7c7SMatt Gilbridemarked `@BetaApi` or not; that annotation is only present as a reminder. There is
124*882aa7c7SMatt Gilbridealso no difference whether a class is marked `@InternalExtensionOnly` or not; that
125*882aa7c7SMatt Gilbrideonly implies that the annotation will still be present in 1.0.0.
126*882aa7c7SMatt Gilbride
127*882aa7c7SMatt Gilbride### Feature notes
128*882aa7c7SMatt Gilbride
129*882aa7c7SMatt Gilbride- **Long Running Operations** - This feature is not yet considered stable.
130*882aa7c7SMatt Gilbride- **Streaming** - Streaming features are not yet considered stable.
131*882aa7c7SMatt Gilbride- **Batching** - Batching features are not yet considered stable.
132*882aa7c7SMatt Gilbride- **Generated Code Support** - Features to support generated code is not yet
133*882aa7c7SMatt Gilbride  considered stable.
134*882aa7c7SMatt Gilbride- **Testing** - There are no plans to consider any code in the testlib jar to be stable.
135*882aa7c7SMatt Gilbride
136*882aa7c7SMatt GilbrideRepository Structure
137*882aa7c7SMatt Gilbride--------------------
138*882aa7c7SMatt Gilbride
139*882aa7c7SMatt GilbrideThis repository contains the following java packages.
140*882aa7c7SMatt Gilbride
141*882aa7c7SMatt Gilbride### gax
142*882aa7c7SMatt Gilbride
143*882aa7c7SMatt GilbrideTransport-independent part of GAX for Java.
144*882aa7c7SMatt GilbrideThe term "transport" in this context usually means the distinction between gRPC or REST.
145*882aa7c7SMatt GilbrideBasically all logic, which does not depend explicitly on gRPC or REST goes to this package.
146*882aa7c7SMatt GilbrideThe examples of such transport-agnostic logic, which is in this package:
147*882aa7c7SMatt Gilbrideretries, pagination, batching, utilities and core logic.
148*882aa7c7SMatt Gilbride
149*882aa7c7SMatt Gilbride- `com.google.api.gax.batching` - Contains general-purpose batching logic.
150*882aa7c7SMatt Gilbride- `com.google.api.gax.core` - Contains core interfaces and classes that are not
151*882aa7c7SMatt Gilbride  specific to grpc and could be used in other contexts.
152*882aa7c7SMatt Gilbride- `com.google.api.gax.longrunning` - Contains classes related to long running
153*882aa7c7SMatt Gilbride  operations.
154*882aa7c7SMatt Gilbride- `com.google.api.gax.paging` - Contains classes related to list calls that return
155*882aa7c7SMatt Gilbride  results in pages.
156*882aa7c7SMatt Gilbride- `com.google.api.gax.retrying` - Contains classes related to retrying API calls.
157*882aa7c7SMatt Gilbride- `com.google.api.gax.rpc` - Contains classes related to making RPC calls.
158*882aa7c7SMatt Gilbride
159*882aa7c7SMatt Gilbride### gax-grpc
160*882aa7c7SMatt Gilbride
161*882aa7c7SMatt GilbrideThis depends on gax module from the above, and has all the gRPC-specific logic,
162*882aa7c7SMatt Gilbridewhich could not go to the gax module because of this dependency on gRPC.
163*882aa7c7SMatt GilbrideBasically it has gRPC-specific implementations of the interfaces and abstract classes defined in gax.
164*882aa7c7SMatt Gilbride
165*882aa7c7SMatt Gilbride- `com.google.api.gax.grpc` - Contains classes that provide functionality on top
166*882aa7c7SMatt Gilbride  of gRPC calls.
167*882aa7c7SMatt Gilbride- `com.google.longrunning` - Contains the mix-in client for long-running operations
168*882aa7c7SMatt Gilbride  which is implemented by a number of Google APIs.
169*882aa7c7SMatt Gilbride
170*882aa7c7SMatt Gilbride### gax-httpjson
171*882aa7c7SMatt Gilbride
172*882aa7c7SMatt GilbrideThis module is very similar to gax-grpc, but depends on REST-specific implementation.
173*882aa7c7SMatt GilbrideIt enables the generated libraries to communicate with the backend services based on HTTP
174*882aa7c7SMatt Gilbride1.1 protocol.
175*882aa7c7SMatt Gilbride
176*882aa7c7SMatt Gilbride- `com.google.api.gax.httpjson` - Contains classes that provide functionality on
177*882aa7c7SMatt Gilbride  top of http/json calls.
178*882aa7c7SMatt Gilbride
179*882aa7c7SMatt GilbrideLicense
180*882aa7c7SMatt Gilbride-------
181*882aa7c7SMatt Gilbride
182*882aa7c7SMatt GilbrideBSD - See [LICENSE] for more information.
183*882aa7c7SMatt Gilbride
184*882aa7c7SMatt Gilbride[CONTRIBUTING]:https://github.com/googleapis/gax-java/blob/main/CONTRIBUTING.md
185*882aa7c7SMatt Gilbride[LICENSE]: https://github.com/googleapis/gax-java/blob/main/LICENSE
186*882aa7c7SMatt Gilbride
187