kafka-client-0.3.1

Kafka messaging client.

License

License

Categories

Categories

Net CLI User Interface Messaging Application Layer Libs
GroupId

GroupId

net.kut3.messaging
ArtifactId

ArtifactId

kafka-client
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

kafka-client-0.3.1
Kafka messaging client.
Project URL

Project URL

http://kut3.net/messaging/kafka

Download kafka-client

How to add to project

<!-- https://jarcasting.com/artifacts/net.kut3.messaging/kafka-client/ -->
<dependency>
    <groupId>net.kut3.messaging</groupId>
    <artifactId>kafka-client</artifactId>
    <version>0.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.kut3.messaging/kafka-client/
implementation 'net.kut3.messaging:kafka-client:0.3.1'
// https://jarcasting.com/artifacts/net.kut3.messaging/kafka-client/
implementation ("net.kut3.messaging:kafka-client:0.3.1")
'net.kut3.messaging:kafka-client:jar:0.3.1'
<dependency org="net.kut3.messaging" name="kafka-client" rev="0.3.1">
  <artifact name="kafka-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.kut3.messaging', module='kafka-client', version='0.3.1')
)
libraryDependencies += "net.kut3.messaging" % "kafka-client" % "0.3.1"
[net.kut3.messaging/kafka-client "0.3.1"]

Dependencies

compile (3)

Group / Artifact Type Version
net.kut3 : messaging jar 0.2.0
ch.qos.logback : logback-classic jar 1.2.3
org.apache.kafka : kafka-clients jar 2.1.1

Project Modules

There are no modules declared in this project.

JSON

Maven dependency

<dependency>
   <groupId>net.kut3</groupId>
   <artifactId>json</artifactId>
   <version>0.2.0</version>
</dependency>

Usage

Parsing from a JSON string

You should know exactly the JSON string is a JsonObject or a JsonArray.

// JsonObject   
JsonObject jo = JsonObject.parse("{...}");`  

// JsonArray  
JsonArray ja = JsonArray.parse("[...]");`   

Create new

// JsonObject   
JsonObject jo = new JsonObject();`

// JsonArray  
JsonArray ja = new JsonArray();`

Adapter for Gson

From v0.2.0 and upper

// JsonObject
com.google.gson.JsonObject gsonObj 
            = new com.google.gson.JsonObject();
    
JsonObject jo = new JsonObject(gsonObj);
    

// JsonArray
com.google.gson.JsonArray gsonArr
            = new com.google.gson.JsonArray();
            
JsonArray ja = new JsonArray(gsonArr);

Get and set

  • Use getXXX(String fieldName) methods to get the value of one field.
  • Use set(String fieldName, XXX fieldValue) to set value for a field (upsert)

To Json string

  • Use toString() method.

Loop

  • Use foreach(...) method to iterate fields of a JsonObject or items of a JsonArray.

Get size and empty checking

  • Use size() and isEmpty() methods.

Get all field names of a JsonObject

From v0.2.0 and upper

jo.fieldNames()

Versions

Version
0.3.1
0.3.0
0.2.0
0.1.0