kafka-jaxb-parent

A pom for deploying to maven central.

License

License

GroupId

GroupId

com.github.jcustenborder.kafka
ArtifactId

ArtifactId

kafka-jaxb-parent
Last Version

Last Version

0.0.1.2
Release Date

Release Date

Type

Type

pom
Description

Description

kafka-jaxb-parent
A pom for deploying to maven central.
Project URL

Project URL

https://github.com/jcustenborder/kafka-jaxb
Source Code Management

Source Code Management

https://github.com/jcustenborder/kafka-jaxb

Download kafka-jaxb-parent

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.jcustenborder.kafka/kafka-jaxb-parent/ -->
<dependency>
    <groupId>com.github.jcustenborder.kafka</groupId>
    <artifactId>kafka-jaxb-parent</artifactId>
    <version>0.0.1.2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.jcustenborder.kafka/kafka-jaxb-parent/
implementation 'com.github.jcustenborder.kafka:kafka-jaxb-parent:0.0.1.2'
// https://jarcasting.com/artifacts/com.github.jcustenborder.kafka/kafka-jaxb-parent/
implementation ("com.github.jcustenborder.kafka:kafka-jaxb-parent:0.0.1.2")
'com.github.jcustenborder.kafka:kafka-jaxb-parent:pom:0.0.1.2'
<dependency org="com.github.jcustenborder.kafka" name="kafka-jaxb-parent" rev="0.0.1.2">
  <artifact name="kafka-jaxb-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.jcustenborder.kafka', module='kafka-jaxb-parent', version='0.0.1.2')
)
libraryDependencies += "com.github.jcustenborder.kafka" % "kafka-jaxb-parent" % "0.0.1.2"
[com.github.jcustenborder.kafka/kafka-jaxb-parent "0.0.1.2"]

Dependencies

provided (2)

Group / Artifact Type Version
org.apache.kafka : kafka-clients jar 0.10.2.1
org.slf4j : slf4j-api jar 1.7.21

test (4)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.0.0-M4
org.junit.jupiter : junit-jupiter-api jar 5.0.0-M4
org.mockito : mockito-core jar 1.10.19
ch.qos.logback : logback-classic jar 1.1.8

Project Modules

  • serializer

Introduction

Sometimes you just need XML. This project is for one of those times where you just need some xml support in Apache Kafka. The goal of this project is to aid with storing XML data in Apache Kafka.

Maven Central

Producing Data

Properties properties = new Properties();
properties.put(JAXBSerializerConfig.JAXB_FORMATTED_OUTPUT_CONF, "true");
properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092");
properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class.toString());
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JAXBSerializer.class.toString());
Producer<Integer, TestPojo> producer = new KafkaProducer<>(properties);

Consuming Data

Properties properties = new Properties();
properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092");
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, IntegerDeserializer.class.toString());
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JAXBDeserializer.class.toString());
Consumer<Integer, TestPojo> consumer = new KafkaConsumer<>(properties);

Example Model

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class TestPojo {
  String name;
  int age;
  int id;

  public String getName() {
    return name;
  }

  @XmlElement
  public void setName(String name) {
    this.name = name;
  }

  public int getAge() {
    return age;
  }

  @XmlElement
  public void setAge(int age) {
    this.age = age;
  }

  public int getId() {
    return id;
  }

  @XmlAttribute
  public void setId(int id) {
    this.id = id;
  }
}

Versions

Version
0.0.1.2