githubEdit

javaJava SDK

The Java SDKarrow-up-right is the easiest way to query the Spice Cloud Platform from Java.

It uses Apache Arrow Flightarrow-up-right to efficiently stream data to the client and Apache Arrowarrow-up-right Records as data frames.

Supported Java Versions

This library supports the following Java implementations:

  • OpenJDK 11

  • OpenJDK 17

  • OpenJDK 21

  • OracleJDK 11

  • OracleJDK 17

  • OracleJDK 21

  • OracleJDK 22

Installation

<dependency>
    <groupId>ai.spice</groupId>
    <artifactId>spiceai</artifactId>
    <version>0.3.0</version>
    <scope>compile</scope>
</dependency>

Usage

1. Import the package.

2. Create a SpiceClient by providing your API key. Get your free API key at spiceuseai.usarrow-up-right.

3. Execute a query and get back a FlightStreamarrow-up-right.

5. Iterate through the FlightStream to access the records.

Check full examplearrow-up-right to learn more.

Usage with local spiceuseai.us OSS runtime

Follow the quickstart guidearrow-up-right to install and run spice locally.

Or using custom flight address:

Check Spice OSS documentationarrow-up-right or Java SDK Samplearrow-up-right to learn more

Connection retry

The SpiceClient implements connection retry mechanism (3 attempts by default). The number of attempts can be configured with withMaxRetries:

Retries are performed for connection and system internal errors. It is the SDK user's responsibility to properly handle other errors, for example RESOURCE_EXHAUSTED (HTTP 429).

Contributing

Contribute to or file an issue with the spice-rs library at: https://github.com/spiceai/spice-javaarrow-up-right

Last updated

Was this helpful?