@@ -123,7 +123,58 @@ GRANT SELECT, MODIFY ON TABLE <catalog_name>.default.air_quality TO `<service-pr
123123
124124### Building Your Application
125125
126- #### 1. Build the SDK from Source
126+ #### Option 1: Using Maven Central (Recommended)
127+
128+ ** Regular JAR (with dependency management):**
129+
130+ Add the SDK as a dependency in your ` pom.xml ` :
131+
132+ ``` xml
133+ <dependencies >
134+ <dependency >
135+ <groupId >com.databricks</groupId >
136+ <artifactId >zerobus-ingest-sdk</artifactId >
137+ <version >0.1.0</version >
138+ </dependency >
139+ </dependencies >
140+ ```
141+
142+ Or with Gradle (` build.gradle ` ):
143+
144+ ``` groovy
145+ dependencies {
146+ implementation 'com.databricks:zerobus-ingest-sdk:0.1.0'
147+ }
148+ ```
149+
150+ Maven and Gradle will automatically download the SDK and all its dependencies (gRPC, protobuf, etc.).
151+
152+ ** Fat JAR (with all dependencies bundled):**
153+
154+ If you prefer the self-contained fat JAR with all dependencies included:
155+
156+ ``` xml
157+ <dependencies >
158+ <dependency >
159+ <groupId >com.databricks</groupId >
160+ <artifactId >zerobus-ingest-sdk</artifactId >
161+ <version >0.1.0</version >
162+ <classifier >jar-with-dependencies</classifier >
163+ </dependency >
164+ </dependencies >
165+ ```
166+
167+ Or with Gradle:
168+
169+ ``` groovy
170+ dependencies {
171+ implementation 'com.databricks:zerobus-ingest-sdk:0.1.0:jar-with-dependencies'
172+ }
173+ ```
174+
175+ ** Note:** The fat JAR is typically not needed for Maven/Gradle projects. Use the regular JAR (without classifier) unless you have a specific reason to bundle all dependencies.
176+
177+ #### Option 2: Build from Source
127178
128179Clone and build the SDK:
129180
@@ -135,52 +186,96 @@ mvn clean package
135186
136187This generates two JAR files in the ` target/ ` directory:
137188
138- - ** Regular JAR** : ` databricks- zerobus-ingest-sdk-0.1.0.jar` (144KB )
189+ - ** Regular JAR** : ` zerobus-ingest-sdk-0.1.0.jar ` (155KB )
139190 - Contains only the SDK classes
140191 - Requires all dependencies on the classpath
141192
142- - ** Fat JAR** : ` databricks- zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar` (18MB)
193+ - ** Fat JAR** : ` zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar ` (18MB)
143194 - Contains SDK classes plus all dependencies bundled
144195 - Self-contained, easier to deploy
145196
146- ** Which one to use?**
147- - Use the ** fat JAR** for simple deployments and standalone applications
148- - Use the ** regular JAR** when dependencies are managed by your build system (Maven/Gradle)
197+ ** Which JAR to use?**
198+ - ** Regular JAR** : When using Maven/Gradle (recommended)
199+ - ** Fat JAR** : For standalone scripts or CLI tools without a build system
200+
201+ ### Create Your Application Project
149202
150- #### 2. Create Your Application Project
203+ #### Using Maven
151204
152- Create a new Java project:
205+ Create a new Maven project:
153206
154207``` bash
155208mkdir my-zerobus-app
156209cd my-zerobus-app
157- mkdir -p src/main/java/com/example
158- mkdir -p src/main/proto
159210```
160211
161- Project structure:
162- ```
163- my-zerobus-app/
164- ├── src/
165- │ └── main/
166- │ ├── java/
167- │ │ └── com/
168- │ │ └── example/
169- │ │ └── ZerobusClient.java
170- │ └── proto/
171- │ └── record.proto
172- └── lib/
173- └── databricks-zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar
174- ```
212+ Create ` pom.xml ` :
175213
176- Copy the fat JAR to your project:
214+ ``` xml
215+ <?xml version =" 1.0" encoding =" UTF-8" ?>
216+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
217+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
218+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0
219+ http://maven.apache.org/xsd/maven-4.0.0.xsd" >
220+ <modelVersion >4.0.0</modelVersion >
221+
222+ <groupId >com.example</groupId >
223+ <artifactId >my-zerobus-app</artifactId >
224+ <version >1.0-SNAPSHOT</version >
225+
226+ <properties >
227+ <maven .compiler.source>1.8</maven .compiler.source>
228+ <maven .compiler.target>1.8</maven .compiler.target>
229+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
230+ </properties >
231+
232+ <dependencies >
233+ <!-- Zerobus SDK -->
234+ <dependency >
235+ <groupId >com.databricks</groupId >
236+ <artifactId >zerobus-ingest-sdk</artifactId >
237+ <version >0.1.0</version >
238+ </dependency >
239+ </dependencies >
240+
241+ <build >
242+ <plugins >
243+ <!-- Protobuf compilation -->
244+ <plugin >
245+ <groupId >org.xolstice.maven.plugins</groupId >
246+ <artifactId >protobuf-maven-plugin</artifactId >
247+ <version >0.6.1</version >
248+ <configuration >
249+ <protocArtifact >com.google.protobuf:protoc:3.24.0:exe:${os.detected.classifier}</protocArtifact >
250+ </configuration >
251+ <executions >
252+ <execution >
253+ <goals >
254+ <goal >compile</goal >
255+ </goals >
256+ </execution >
257+ </executions >
258+ </plugin >
259+ </plugins >
260+ <extensions >
261+ <extension >
262+ <groupId >kr.motd.maven</groupId >
263+ <artifactId >os-maven-plugin</artifactId >
264+ <version >1.7.1</version >
265+ </extension >
266+ </extensions >
267+ </build >
268+ </project >
269+ ```
270+
271+ Create project structure:
177272
178273``` bash
179- mkdir lib
180- cp ../zerobus-sdk-java/target/databricks-zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar lib/
274+ mkdir -p src/main/java/com/example
275+ mkdir -p src/main/proto
181276```
182277
183- #### 3. Define Your Protocol Buffer Schema
278+ #### Define Your Protocol Buffer Schema
184279
185280Create ` src/main/proto/record.proto ` :
186281
@@ -215,10 +310,22 @@ Instead of manually writing and compiling your protobuf schema, you can automati
215310
216311The ` GenerateProto ` tool fetches your table schema from Unity Catalog and generates a corresponding proto2 definition file with the correct type mappings.
217312
218- ** Basic Usage:**
313+ ** First, download the fat JAR:**
314+
315+ The proto generation tool requires the fat JAR (all dependencies included):
316+
317+ ``` bash
318+ # Download from Maven Central
319+ wget https://repo1.maven.org/maven2/com/databricks/zerobus-ingest-sdk/0.1.0/zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar
320+
321+ # Or if you built from source, it's in target/
322+ # cp target/zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar .
323+ ```
324+
325+ ** Run the tool:**
219326
220327``` bash
221- java -jar lib/databricks- zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar \
328+ java -jar zerobus-ingest-sdk-0.1.0-jar-with-dependencies.jar \
222329 --uc-endpoint " https://dbc-a1b2c3d4-e5f6.cloud.databricks.com" \
223330 --client-id " your-service-principal-application-id" \
224331 --client-secret " your-service-principal-secret" \
@@ -353,17 +460,35 @@ public class ZerobusClient {
353460}
354461```
355462
356- #### 5. Compile and Run
463+ #### Compile and Run
357464
358- Compile your application:
465+ ** Using Maven: **
359466
360467``` bash
361- javac -cp " lib/*" -d out src/main/java/com/example/ZerobusClient.java src/main/java/com/example/proto/Record.java
468+ # Compile protobuf and Java code
469+ mvn compile
470+
471+ # Run your application
472+ mvn exec:java -Dexec.mainClass=" com.example.ZerobusClient"
362473```
363474
364- Run your application:
475+ ** Or build and run as JAR: **
365476
366477``` bash
478+ # Package into JAR
479+ mvn package
480+
481+ # Run the JAR
482+ java -jar target/my-zerobus-app-1.0-SNAPSHOT.jar
483+ ```
484+
485+ ** Using downloaded JAR (without Maven):**
486+
487+ ``` bash
488+ # Compile
489+ javac -cp " lib/*" -d out src/main/java/com/example/ZerobusClient.java src/main/java/com/example/proto/Record.java
490+
491+ # Run
367492java -cp " lib/*:out" com.example.ZerobusClient
368493```
369494
0 commit comments