diff --git a/pos-fanout-avro/README.md b/pos-fanout-avro/README.md new file mode 100644 index 0000000..f0a26ed --- /dev/null +++ b/pos-fanout-avro/README.md @@ -0,0 +1,5 @@ +This directory contains Kafka Streams example. + +The project uses avro-maven-plugin to generate classes. + +Do not manually modify classes in types directory \ No newline at end of file diff --git a/pos-fanout-avro/pom.xml b/pos-fanout-avro/pom.xml new file mode 100644 index 0000000..cad6ee0 --- /dev/null +++ b/pos-fanout-avro/pom.xml @@ -0,0 +1,131 @@ + + + + + 4.0.0 + + guru.learningjournal.kafka.examples + pos-fanout-avro + 2.0.0 + + + 1.8.1 + 2.0.0 + 2.11.1 + 5.3.1 + 1.8 + 5.0.1 + + + + + confluent + https://packages.confluent.io/maven/ + + + + + + + org.apache.avro + avro + ${avro.version} + + + + io.confluent + kafka-streams-avro-serde + ${confluent.version} + + + + org.apache.kafka + kafka-clients + 2.0.0 + + + + org.apache.kafka + kafka-streams + 2.0.0 + + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.11.0 + + + + org.junit.jupiter + junit-jupiter-api + 5.3.1 + test + + + + org.junit.jupiter + junit-jupiter-engine + 5.3.1 + test + + + + org.junit.jupiter + junit-jupiter-params + 5.3.1 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + ${java.version} + ${java.version} + + + + + + org.apache.avro + avro-maven-plugin + ${avro.version} + + + generate-sources + + schema + + + ${project.basedir}/src/main/resources/schema/ + ${project.basedir}/src/main/java/ + + + + + + + + + \ No newline at end of file diff --git a/pos-fanout-avro/scripts/start-hadoop-sink-consumer.cmd b/pos-fanout-avro/scripts/start-hadoop-sink-consumer.cmd new file mode 100644 index 0000000..08f1042 --- /dev/null +++ b/pos-fanout-avro/scripts/start-hadoop-sink-consumer.cmd @@ -0,0 +1 @@ +C:\Users\prashant\Downloads\confluent-5.0.1\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic hadoop-sink --from-beginning \ No newline at end of file diff --git a/pos-fanout-avro/scripts/start-kafka-server-0.cmd b/pos-fanout-avro/scripts/start-kafka-server-0.cmd new file mode 100644 index 0000000..d0adb2e --- /dev/null +++ b/pos-fanout-avro/scripts/start-kafka-server-0.cmd @@ -0,0 +1 @@ +C:\Users\prashant\Downloads\confluent-5.0.1\bin\windows\kafka-server-start.bat C:\Users\prashant\Downloads\confluent-5.0.1\etc\kafka\server-0.properties diff --git a/pos-fanout-avro/scripts/start-kafka-server-1.cmd b/pos-fanout-avro/scripts/start-kafka-server-1.cmd new file mode 100644 index 0000000..53734ad --- /dev/null +++ b/pos-fanout-avro/scripts/start-kafka-server-1.cmd @@ -0,0 +1 @@ +C:\Users\prashant\Downloads\confluent-5.0.1\bin\windows\kafka-server-start.bat C:\Users\prashant\Downloads\confluent-5.0.1\etc\kafka\server-1.properties \ No newline at end of file diff --git a/pos-fanout-avro/scripts/start-kafka-server-2.cmd b/pos-fanout-avro/scripts/start-kafka-server-2.cmd new file mode 100644 index 0000000..d1e2e7f --- /dev/null +++ b/pos-fanout-avro/scripts/start-kafka-server-2.cmd @@ -0,0 +1 @@ +C:\Users\prashant\Downloads\confluent-5.0.1\bin\windows\kafka-server-start.bat C:\Users\prashant\Downloads\confluent-5.0.1\etc\kafka\server-2.properties \ No newline at end of file diff --git a/pos-fanout-avro/scripts/start-schema-registry.cmd b/pos-fanout-avro/scripts/start-schema-registry.cmd new file mode 100644 index 0000000..62fc6f6 --- /dev/null +++ b/pos-fanout-avro/scripts/start-schema-registry.cmd @@ -0,0 +1 @@ +C:\Users\prashant\Downloads\confluent-5.0.1\bin\windows\schema-registry-start.bat C:\Users\prashant\Downloads\confluent-5.0.1\etc\schema-registry\schema-registry.properties \ No newline at end of file diff --git a/pos-fanout-avro/scripts/start-zookeeper.cmd b/pos-fanout-avro/scripts/start-zookeeper.cmd new file mode 100644 index 0000000..77279c3 --- /dev/null +++ b/pos-fanout-avro/scripts/start-zookeeper.cmd @@ -0,0 +1 @@ +C:\Users\prashant\Downloads\confluent-5.0.1\bin\windows\zookeeper-server-start.bat C:\Users\prashant\Downloads\confluent-5.0.1\etc\kafka\zookeeper.properties \ No newline at end of file diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/FanOutConfigs.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/FanOutConfigs.java new file mode 100644 index 0000000..6fffcd1 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/FanOutConfigs.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019. Prashant Kumar Pandey + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations under the License. + */ + +package guru.learningjournal.kafka.examples; + +/** + * Configurations for the PosFanOutApp + * + * @author prashant + * @author www.learningjournal.guru + */ + +class FanOutConfigs { + final static String applicationID = "PosFanOutApp"; + final static String bootstrapServers = "localhost:9092"; + final static String posTopicName = "pos"; + final static String shipmentTopicName = "shipment"; + final static String notificationTopic = "loyalty"; + final static String hadoopTopic = "hadoop-sink"; + final static String DELIVERY_TYPE_HOME_DELIVERY = "HOME-DELIVERY"; + final static String CUSTOMER_TYPE_PRIME = "PRIME"; + final static Double LOYALTY_FACTOR = 0.02; +} \ No newline at end of file diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/PosFanOutApp.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/PosFanOutApp.java new file mode 100644 index 0000000..8fae682 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/PosFanOutApp.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2019. Prashant Kumar Pandey + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations under the License. + */ + +package guru.learningjournal.kafka.examples; + +import guru.learningjournal.kafka.examples.types.HadoopRecord; +import guru.learningjournal.kafka.examples.types.Notification; +import guru.learningjournal.kafka.examples.types.PosInvoice; +import org.apache.kafka.streams.KafkaStreams; +import org.apache.kafka.streams.StreamsBuilder; +import org.apache.kafka.streams.StreamsConfig; +import org.apache.kafka.streams.Topology; +import org.apache.kafka.streams.kstream.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.*; + +/** + * Transform and FanOut Invoices to different topics for other services + * + * @author prashant + * @author www.learningjournal.guru + */ + +@SuppressWarnings("unchecked") +public class PosFanOutApp { + private static final Logger logger = LogManager.getLogger(); + + public static void main(String[] args) { + Properties props = new Properties(); + props.put(StreamsConfig.APPLICATION_ID_CONFIG, FanOutConfigs.applicationID); + props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, FanOutConfigs.bootstrapServers); + + StreamsBuilder builder = new StreamsBuilder(); + KStream KS0 = builder.stream(FanOutConfigs.posTopicName, + Consumed.with(PosSerdes.String(), PosSerdes.PosInvoice())); + + //Requirement 1 - Produce to shipment + KStream KS1 = KS0.filter((Predicate) (key, value) -> + value.getDeliveryType().toString() + .equalsIgnoreCase(FanOutConfigs.DELIVERY_TYPE_HOME_DELIVERY)); + + KS1.to(FanOutConfigs.shipmentTopicName, + Produced.with(PosSerdes.String(), PosSerdes.PosInvoice())); + + //Requirement 2 - Produce to loyaltyHadoopRecord + KStream KS3 = KS0.filter((Predicate) (key, value) -> + value.getCustomerType().toString() + .equalsIgnoreCase(FanOutConfigs.CUSTOMER_TYPE_PRIME)); + + KStream KS4 = KS3.mapValues((ValueMapper) + RecordBuilder::getNotification); + + KS4.to(FanOutConfigs.notificationTopic, + Produced.with(PosSerdes.String(), PosSerdes.Notification())); + + //Requirement 3 - Produce to Hadoop + KStream KS6 = KS0.mapValues((ValueMapper) + RecordBuilder::getMaskedInvoice); + + KStream KS7 = KS6.flatMapValues((ValueMapper>) + RecordBuilder::getHadoopRecords); + + KS7.to(FanOutConfigs.hadoopTopic, + Produced.with(PosSerdes.String(), PosSerdes.HadoopRecord())); + + Topology posFanOutTopology = builder.build(); + + logger.info("Starting the following topology"); + logger.info(posFanOutTopology.describe().toString()); + + KafkaStreams myStream = new KafkaStreams(posFanOutTopology, props); + myStream.start(); + + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + logger.info("Stopping Stream"); + myStream.close(); + })); + } +} \ No newline at end of file diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/PosSerdes.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/PosSerdes.java new file mode 100644 index 0000000..1f71172 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/PosSerdes.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019. Prashant Kumar Pandey + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations under the License. + */ + +package guru.learningjournal.kafka.examples; + +import guru.learningjournal.kafka.examples.types.HadoopRecord; +import guru.learningjournal.kafka.examples.types.Notification; +import guru.learningjournal.kafka.examples.types.PosInvoice; +import io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde; +import org.apache.kafka.common.serialization.Serde; +import org.apache.kafka.common.serialization.Serdes; + +import java.util.Collections; +import java.util.Map; + +/** + * Extend Kafka Streams Serdes to add custom specific Avro Serdes + * + * @author prashant + * @author www.learningjournal.guru + */ +class PosSerdes extends Serdes { + private final static Map serdeConfig = Collections.singletonMap( + "schema.registry.url", + "http://localhost:8081"); + + static Serde PosInvoice() { + final Serde specificAvroSerde = new SpecificAvroSerde<>(); + specificAvroSerde.configure(serdeConfig, false); + return specificAvroSerde; + } + + static Serde Notification() { + final Serde specificAvroSerde = new SpecificAvroSerde<>(); + specificAvroSerde.configure(serdeConfig, false); + return specificAvroSerde; + } + + static Serde HadoopRecord() { + final Serde specificAvroSerde = new SpecificAvroSerde<>(); + specificAvroSerde.configure(serdeConfig, false); + return specificAvroSerde; + } +} diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/RecordBuilder.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/RecordBuilder.java new file mode 100644 index 0000000..0881522 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/RecordBuilder.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2019. Prashant Kumar Pandey + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and limitations under the License. + */ + +package guru.learningjournal.kafka.examples; + +import guru.learningjournal.kafka.examples.types.HadoopRecord; +import guru.learningjournal.kafka.examples.types.Notification; +import guru.learningjournal.kafka.examples.types.PosInvoice; +import guru.learningjournal.kafka.examples.types.PosLineItem; + +import java.util.ArrayList; +import java.util.List; + +/** + * Transform Invoice to other Objects + * + * @author prashant + * @author www.learningjournal.guru + */ + +class RecordBuilder { + /** + * Create a flattened List of HadoopRecords from Invoice + * Each Line Item is denormalized into an independent record + * + * @param invoice PosInvoice object + * @return List of HadoopRecord + */ + static List getHadoopRecords(PosInvoice invoice) { + List records = new ArrayList<>(); + + for (PosLineItem i : invoice.getInvoiceLineItems()) { + HadoopRecord record = new HadoopRecord(); + record.setInvoiceNumber(invoice.getInvoiceNumber()); + record.setCreatedTime(invoice.getCreatedTime()); + record.setStoreID(invoice.getStoreID()); + record.setPosID(invoice.getPosID()); + record.setCustomerType(invoice.getCustomerType()); + record.setPaymentMethod(invoice.getPaymentMethod()); + record.setDeliveryType(invoice.getDeliveryType()); + record.setItemCode(i.getItemCode()); + record.setItemDescription(i.getItemDescription()); + record.setItemPrice(i.getItemPrice()); + record.setItemQty(i.getItemQty()); + record.setTotalValue(i.getTotalValue()); + if (invoice.getDeliveryType().toString().equalsIgnoreCase(FanOutConfigs.DELIVERY_TYPE_HOME_DELIVERY)) { + record.setCity(invoice.getDeliveryAddress().getCity()); + record.setState(invoice.getDeliveryAddress().getState()); + record.setPinCode(invoice.getDeliveryAddress().getPinCode()); + } + records.add(record); + } + return records; + } + + /** + * Set personally identifiable values to null + * + * @param invoice PosInvoice object + * @return masked PosInvoice object + */ + static PosInvoice getMaskedInvoice(PosInvoice invoice) { + invoice.setCustomerCardNo(null); + if (invoice.getDeliveryType().toString().equalsIgnoreCase(FanOutConfigs.DELIVERY_TYPE_HOME_DELIVERY)) { + invoice.getDeliveryAddress().setAddressLine(null); + invoice.getDeliveryAddress().setContactNumber(null); + } + return invoice; + } + + /** + * Transform PosInvoice to Notification + * + * @param invoice PosInvoice Object + * @return Notification Object + */ + static Notification getNotification(PosInvoice invoice) { + Notification notification = new Notification(); + + notification.setInvoiceNumber(invoice.getInvoiceNumber()); + notification.setCustomerCardNo(invoice.getCustomerCardNo()); + notification.setTotalAmount(invoice.getTotalAmount()); + notification.setEarnedLoyaltyPoints(invoice.getTotalAmount() * FanOutConfigs.LOYALTY_FACTOR); + return notification; + } +} \ No newline at end of file diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/DeliveryAddress.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/DeliveryAddress.java new file mode 100644 index 0000000..8b5b1d7 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/DeliveryAddress.java @@ -0,0 +1,477 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package guru.learningjournal.kafka.examples.types; + +import org.apache.avro.specific.SpecificData; + +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class DeliveryAddress extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -5628348551213908391L; + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"DeliveryAddress\",\"namespace\":\"guru.learningjournal.kafka.examples.types\",\"fields\":[{\"name\":\"AddressLine\",\"type\":[\"null\",\"string\"]},{\"name\":\"City\",\"type\":[\"null\",\"string\"]},{\"name\":\"State\",\"type\":[\"null\",\"string\"]},{\"name\":\"PinCode\",\"type\":[\"null\",\"string\"]},{\"name\":\"ContactNumber\",\"type\":[\"null\",\"string\"]}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + @Deprecated public java.lang.CharSequence AddressLine; + @Deprecated public java.lang.CharSequence City; + @Deprecated public java.lang.CharSequence State; + @Deprecated public java.lang.CharSequence PinCode; + @Deprecated public java.lang.CharSequence ContactNumber; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use newBuilder(). + */ + public DeliveryAddress() {} + + /** + * All-args constructor. + * @param AddressLine The new value for AddressLine + * @param City The new value for City + * @param State The new value for State + * @param PinCode The new value for PinCode + * @param ContactNumber The new value for ContactNumber + */ + public DeliveryAddress(java.lang.CharSequence AddressLine, java.lang.CharSequence City, java.lang.CharSequence State, java.lang.CharSequence PinCode, java.lang.CharSequence ContactNumber) { + this.AddressLine = AddressLine; + this.City = City; + this.State = State; + this.PinCode = PinCode; + this.ContactNumber = ContactNumber; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return AddressLine; + case 1: return City; + case 2: return State; + case 3: return PinCode; + case 4: return ContactNumber; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: AddressLine = (java.lang.CharSequence)value$; break; + case 1: City = (java.lang.CharSequence)value$; break; + case 2: State = (java.lang.CharSequence)value$; break; + case 3: PinCode = (java.lang.CharSequence)value$; break; + case 4: ContactNumber = (java.lang.CharSequence)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'AddressLine' field. + * @return The value of the 'AddressLine' field. + */ + public java.lang.CharSequence getAddressLine() { + return AddressLine; + } + + /** + * Sets the value of the 'AddressLine' field. + * @param value the value to set. + */ + public void setAddressLine(java.lang.CharSequence value) { + this.AddressLine = value; + } + + /** + * Gets the value of the 'City' field. + * @return The value of the 'City' field. + */ + public java.lang.CharSequence getCity() { + return City; + } + + /** + * Sets the value of the 'City' field. + * @param value the value to set. + */ + public void setCity(java.lang.CharSequence value) { + this.City = value; + } + + /** + * Gets the value of the 'State' field. + * @return The value of the 'State' field. + */ + public java.lang.CharSequence getState() { + return State; + } + + /** + * Sets the value of the 'State' field. + * @param value the value to set. + */ + public void setState(java.lang.CharSequence value) { + this.State = value; + } + + /** + * Gets the value of the 'PinCode' field. + * @return The value of the 'PinCode' field. + */ + public java.lang.CharSequence getPinCode() { + return PinCode; + } + + /** + * Sets the value of the 'PinCode' field. + * @param value the value to set. + */ + public void setPinCode(java.lang.CharSequence value) { + this.PinCode = value; + } + + /** + * Gets the value of the 'ContactNumber' field. + * @return The value of the 'ContactNumber' field. + */ + public java.lang.CharSequence getContactNumber() { + return ContactNumber; + } + + /** + * Sets the value of the 'ContactNumber' field. + * @param value the value to set. + */ + public void setContactNumber(java.lang.CharSequence value) { + this.ContactNumber = value; + } + + /** + * Creates a new DeliveryAddress RecordBuilder. + * @return A new DeliveryAddress RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder newBuilder() { + return new guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder(); + } + + /** + * Creates a new DeliveryAddress RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new DeliveryAddress RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder newBuilder(guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder other) { + return new guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder(other); + } + + /** + * Creates a new DeliveryAddress RecordBuilder by copying an existing DeliveryAddress instance. + * @param other The existing instance to copy. + * @return A new DeliveryAddress RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder newBuilder(guru.learningjournal.kafka.examples.types.DeliveryAddress other) { + return new guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder(other); + } + + /** + * RecordBuilder for DeliveryAddress instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private java.lang.CharSequence AddressLine; + private java.lang.CharSequence City; + private java.lang.CharSequence State; + private java.lang.CharSequence PinCode; + private java.lang.CharSequence ContactNumber; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder other) { + super(other); + if (isValidValue(fields()[0], other.AddressLine)) { + this.AddressLine = data().deepCopy(fields()[0].schema(), other.AddressLine); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.City)) { + this.City = data().deepCopy(fields()[1].schema(), other.City); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.State)) { + this.State = data().deepCopy(fields()[2].schema(), other.State); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.PinCode)) { + this.PinCode = data().deepCopy(fields()[3].schema(), other.PinCode); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.ContactNumber)) { + this.ContactNumber = data().deepCopy(fields()[4].schema(), other.ContactNumber); + fieldSetFlags()[4] = true; + } + } + + /** + * Creates a Builder by copying an existing DeliveryAddress instance + * @param other The existing instance to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.DeliveryAddress other) { + super(SCHEMA$); + if (isValidValue(fields()[0], other.AddressLine)) { + this.AddressLine = data().deepCopy(fields()[0].schema(), other.AddressLine); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.City)) { + this.City = data().deepCopy(fields()[1].schema(), other.City); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.State)) { + this.State = data().deepCopy(fields()[2].schema(), other.State); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.PinCode)) { + this.PinCode = data().deepCopy(fields()[3].schema(), other.PinCode); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.ContactNumber)) { + this.ContactNumber = data().deepCopy(fields()[4].schema(), other.ContactNumber); + fieldSetFlags()[4] = true; + } + } + + /** + * Gets the value of the 'AddressLine' field. + * @return The value. + */ + public java.lang.CharSequence getAddressLine() { + return AddressLine; + } + + /** + * Sets the value of the 'AddressLine' field. + * @param value The value of 'AddressLine'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder setAddressLine(java.lang.CharSequence value) { + validate(fields()[0], value); + this.AddressLine = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'AddressLine' field has been set. + * @return True if the 'AddressLine' field has been set, false otherwise. + */ + public boolean hasAddressLine() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'AddressLine' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder clearAddressLine() { + AddressLine = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'City' field. + * @return The value. + */ + public java.lang.CharSequence getCity() { + return City; + } + + /** + * Sets the value of the 'City' field. + * @param value The value of 'City'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder setCity(java.lang.CharSequence value) { + validate(fields()[1], value); + this.City = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'City' field has been set. + * @return True if the 'City' field has been set, false otherwise. + */ + public boolean hasCity() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'City' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder clearCity() { + City = null; + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'State' field. + * @return The value. + */ + public java.lang.CharSequence getState() { + return State; + } + + /** + * Sets the value of the 'State' field. + * @param value The value of 'State'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder setState(java.lang.CharSequence value) { + validate(fields()[2], value); + this.State = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'State' field has been set. + * @return True if the 'State' field has been set, false otherwise. + */ + public boolean hasState() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'State' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder clearState() { + State = null; + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'PinCode' field. + * @return The value. + */ + public java.lang.CharSequence getPinCode() { + return PinCode; + } + + /** + * Sets the value of the 'PinCode' field. + * @param value The value of 'PinCode'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder setPinCode(java.lang.CharSequence value) { + validate(fields()[3], value); + this.PinCode = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'PinCode' field has been set. + * @return True if the 'PinCode' field has been set, false otherwise. + */ + public boolean hasPinCode() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'PinCode' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder clearPinCode() { + PinCode = null; + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'ContactNumber' field. + * @return The value. + */ + public java.lang.CharSequence getContactNumber() { + return ContactNumber; + } + + /** + * Sets the value of the 'ContactNumber' field. + * @param value The value of 'ContactNumber'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder setContactNumber(java.lang.CharSequence value) { + validate(fields()[4], value); + this.ContactNumber = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'ContactNumber' field has been set. + * @return True if the 'ContactNumber' field has been set, false otherwise. + */ + public boolean hasContactNumber() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'ContactNumber' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder clearContactNumber() { + ContactNumber = null; + fieldSetFlags()[4] = false; + return this; + } + + @Override + public DeliveryAddress build() { + try { + DeliveryAddress record = new DeliveryAddress(); + record.AddressLine = fieldSetFlags()[0] ? this.AddressLine : (java.lang.CharSequence) defaultValue(fields()[0]); + record.City = fieldSetFlags()[1] ? this.City : (java.lang.CharSequence) defaultValue(fields()[1]); + record.State = fieldSetFlags()[2] ? this.State : (java.lang.CharSequence) defaultValue(fields()[2]); + record.PinCode = fieldSetFlags()[3] ? this.PinCode : (java.lang.CharSequence) defaultValue(fields()[3]); + record.ContactNumber = fieldSetFlags()[4] ? this.ContactNumber : (java.lang.CharSequence) defaultValue(fields()[4]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + private static final org.apache.avro.io.DatumWriter + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + private static final org.apache.avro.io.DatumReader + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + +} diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/HadoopRecord.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/HadoopRecord.java new file mode 100644 index 0000000..be74b16 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/HadoopRecord.java @@ -0,0 +1,1177 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package guru.learningjournal.kafka.examples.types; + +import org.apache.avro.specific.SpecificData; + +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class HadoopRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = 2312947333715807165L; + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HadoopRecord\",\"namespace\":\"guru.learningjournal.kafka.examples.types\",\"fields\":[{\"name\":\"InvoiceNumber\",\"type\":[\"null\",\"string\"]},{\"name\":\"CreatedTime\",\"type\":[\"null\",\"long\"]},{\"name\":\"StoreID\",\"type\":[\"null\",\"string\"]},{\"name\":\"PosID\",\"type\":[\"null\",\"string\"]},{\"name\":\"CustomerType\",\"type\":[\"null\",\"string\"]},{\"name\":\"PaymentMethod\",\"type\":[\"null\",\"string\"]},{\"name\":\"DeliveryType\",\"type\":[\"null\",\"string\"]},{\"name\":\"City\",\"type\":[\"null\",\"string\"]},{\"name\":\"State\",\"type\":[\"null\",\"string\"]},{\"name\":\"PinCode\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemCode\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemDescription\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemPrice\",\"type\":[\"null\",\"double\"]},{\"name\":\"ItemQty\",\"type\":[\"null\",\"int\"]},{\"name\":\"TotalValue\",\"type\":[\"null\",\"double\"]}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + @Deprecated public java.lang.CharSequence InvoiceNumber; + @Deprecated public java.lang.Long CreatedTime; + @Deprecated public java.lang.CharSequence StoreID; + @Deprecated public java.lang.CharSequence PosID; + @Deprecated public java.lang.CharSequence CustomerType; + @Deprecated public java.lang.CharSequence PaymentMethod; + @Deprecated public java.lang.CharSequence DeliveryType; + @Deprecated public java.lang.CharSequence City; + @Deprecated public java.lang.CharSequence State; + @Deprecated public java.lang.CharSequence PinCode; + @Deprecated public java.lang.CharSequence ItemCode; + @Deprecated public java.lang.CharSequence ItemDescription; + @Deprecated public java.lang.Double ItemPrice; + @Deprecated public java.lang.Integer ItemQty; + @Deprecated public java.lang.Double TotalValue; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use newBuilder(). + */ + public HadoopRecord() {} + + /** + * All-args constructor. + * @param InvoiceNumber The new value for InvoiceNumber + * @param CreatedTime The new value for CreatedTime + * @param StoreID The new value for StoreID + * @param PosID The new value for PosID + * @param CustomerType The new value for CustomerType + * @param PaymentMethod The new value for PaymentMethod + * @param DeliveryType The new value for DeliveryType + * @param City The new value for City + * @param State The new value for State + * @param PinCode The new value for PinCode + * @param ItemCode The new value for ItemCode + * @param ItemDescription The new value for ItemDescription + * @param ItemPrice The new value for ItemPrice + * @param ItemQty The new value for ItemQty + * @param TotalValue The new value for TotalValue + */ + public HadoopRecord(java.lang.CharSequence InvoiceNumber, java.lang.Long CreatedTime, java.lang.CharSequence StoreID, java.lang.CharSequence PosID, java.lang.CharSequence CustomerType, java.lang.CharSequence PaymentMethod, java.lang.CharSequence DeliveryType, java.lang.CharSequence City, java.lang.CharSequence State, java.lang.CharSequence PinCode, java.lang.CharSequence ItemCode, java.lang.CharSequence ItemDescription, java.lang.Double ItemPrice, java.lang.Integer ItemQty, java.lang.Double TotalValue) { + this.InvoiceNumber = InvoiceNumber; + this.CreatedTime = CreatedTime; + this.StoreID = StoreID; + this.PosID = PosID; + this.CustomerType = CustomerType; + this.PaymentMethod = PaymentMethod; + this.DeliveryType = DeliveryType; + this.City = City; + this.State = State; + this.PinCode = PinCode; + this.ItemCode = ItemCode; + this.ItemDescription = ItemDescription; + this.ItemPrice = ItemPrice; + this.ItemQty = ItemQty; + this.TotalValue = TotalValue; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return InvoiceNumber; + case 1: return CreatedTime; + case 2: return StoreID; + case 3: return PosID; + case 4: return CustomerType; + case 5: return PaymentMethod; + case 6: return DeliveryType; + case 7: return City; + case 8: return State; + case 9: return PinCode; + case 10: return ItemCode; + case 11: return ItemDescription; + case 12: return ItemPrice; + case 13: return ItemQty; + case 14: return TotalValue; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: InvoiceNumber = (java.lang.CharSequence)value$; break; + case 1: CreatedTime = (java.lang.Long)value$; break; + case 2: StoreID = (java.lang.CharSequence)value$; break; + case 3: PosID = (java.lang.CharSequence)value$; break; + case 4: CustomerType = (java.lang.CharSequence)value$; break; + case 5: PaymentMethod = (java.lang.CharSequence)value$; break; + case 6: DeliveryType = (java.lang.CharSequence)value$; break; + case 7: City = (java.lang.CharSequence)value$; break; + case 8: State = (java.lang.CharSequence)value$; break; + case 9: PinCode = (java.lang.CharSequence)value$; break; + case 10: ItemCode = (java.lang.CharSequence)value$; break; + case 11: ItemDescription = (java.lang.CharSequence)value$; break; + case 12: ItemPrice = (java.lang.Double)value$; break; + case 13: ItemQty = (java.lang.Integer)value$; break; + case 14: TotalValue = (java.lang.Double)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'InvoiceNumber' field. + * @return The value of the 'InvoiceNumber' field. + */ + public java.lang.CharSequence getInvoiceNumber() { + return InvoiceNumber; + } + + /** + * Sets the value of the 'InvoiceNumber' field. + * @param value the value to set. + */ + public void setInvoiceNumber(java.lang.CharSequence value) { + this.InvoiceNumber = value; + } + + /** + * Gets the value of the 'CreatedTime' field. + * @return The value of the 'CreatedTime' field. + */ + public java.lang.Long getCreatedTime() { + return CreatedTime; + } + + /** + * Sets the value of the 'CreatedTime' field. + * @param value the value to set. + */ + public void setCreatedTime(java.lang.Long value) { + this.CreatedTime = value; + } + + /** + * Gets the value of the 'StoreID' field. + * @return The value of the 'StoreID' field. + */ + public java.lang.CharSequence getStoreID() { + return StoreID; + } + + /** + * Sets the value of the 'StoreID' field. + * @param value the value to set. + */ + public void setStoreID(java.lang.CharSequence value) { + this.StoreID = value; + } + + /** + * Gets the value of the 'PosID' field. + * @return The value of the 'PosID' field. + */ + public java.lang.CharSequence getPosID() { + return PosID; + } + + /** + * Sets the value of the 'PosID' field. + * @param value the value to set. + */ + public void setPosID(java.lang.CharSequence value) { + this.PosID = value; + } + + /** + * Gets the value of the 'CustomerType' field. + * @return The value of the 'CustomerType' field. + */ + public java.lang.CharSequence getCustomerType() { + return CustomerType; + } + + /** + * Sets the value of the 'CustomerType' field. + * @param value the value to set. + */ + public void setCustomerType(java.lang.CharSequence value) { + this.CustomerType = value; + } + + /** + * Gets the value of the 'PaymentMethod' field. + * @return The value of the 'PaymentMethod' field. + */ + public java.lang.CharSequence getPaymentMethod() { + return PaymentMethod; + } + + /** + * Sets the value of the 'PaymentMethod' field. + * @param value the value to set. + */ + public void setPaymentMethod(java.lang.CharSequence value) { + this.PaymentMethod = value; + } + + /** + * Gets the value of the 'DeliveryType' field. + * @return The value of the 'DeliveryType' field. + */ + public java.lang.CharSequence getDeliveryType() { + return DeliveryType; + } + + /** + * Sets the value of the 'DeliveryType' field. + * @param value the value to set. + */ + public void setDeliveryType(java.lang.CharSequence value) { + this.DeliveryType = value; + } + + /** + * Gets the value of the 'City' field. + * @return The value of the 'City' field. + */ + public java.lang.CharSequence getCity() { + return City; + } + + /** + * Sets the value of the 'City' field. + * @param value the value to set. + */ + public void setCity(java.lang.CharSequence value) { + this.City = value; + } + + /** + * Gets the value of the 'State' field. + * @return The value of the 'State' field. + */ + public java.lang.CharSequence getState() { + return State; + } + + /** + * Sets the value of the 'State' field. + * @param value the value to set. + */ + public void setState(java.lang.CharSequence value) { + this.State = value; + } + + /** + * Gets the value of the 'PinCode' field. + * @return The value of the 'PinCode' field. + */ + public java.lang.CharSequence getPinCode() { + return PinCode; + } + + /** + * Sets the value of the 'PinCode' field. + * @param value the value to set. + */ + public void setPinCode(java.lang.CharSequence value) { + this.PinCode = value; + } + + /** + * Gets the value of the 'ItemCode' field. + * @return The value of the 'ItemCode' field. + */ + public java.lang.CharSequence getItemCode() { + return ItemCode; + } + + /** + * Sets the value of the 'ItemCode' field. + * @param value the value to set. + */ + public void setItemCode(java.lang.CharSequence value) { + this.ItemCode = value; + } + + /** + * Gets the value of the 'ItemDescription' field. + * @return The value of the 'ItemDescription' field. + */ + public java.lang.CharSequence getItemDescription() { + return ItemDescription; + } + + /** + * Sets the value of the 'ItemDescription' field. + * @param value the value to set. + */ + public void setItemDescription(java.lang.CharSequence value) { + this.ItemDescription = value; + } + + /** + * Gets the value of the 'ItemPrice' field. + * @return The value of the 'ItemPrice' field. + */ + public java.lang.Double getItemPrice() { + return ItemPrice; + } + + /** + * Sets the value of the 'ItemPrice' field. + * @param value the value to set. + */ + public void setItemPrice(java.lang.Double value) { + this.ItemPrice = value; + } + + /** + * Gets the value of the 'ItemQty' field. + * @return The value of the 'ItemQty' field. + */ + public java.lang.Integer getItemQty() { + return ItemQty; + } + + /** + * Sets the value of the 'ItemQty' field. + * @param value the value to set. + */ + public void setItemQty(java.lang.Integer value) { + this.ItemQty = value; + } + + /** + * Gets the value of the 'TotalValue' field. + * @return The value of the 'TotalValue' field. + */ + public java.lang.Double getTotalValue() { + return TotalValue; + } + + /** + * Sets the value of the 'TotalValue' field. + * @param value the value to set. + */ + public void setTotalValue(java.lang.Double value) { + this.TotalValue = value; + } + + /** + * Creates a new HadoopRecord RecordBuilder. + * @return A new HadoopRecord RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.HadoopRecord.Builder newBuilder() { + return new guru.learningjournal.kafka.examples.types.HadoopRecord.Builder(); + } + + /** + * Creates a new HadoopRecord RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new HadoopRecord RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.HadoopRecord.Builder newBuilder(guru.learningjournal.kafka.examples.types.HadoopRecord.Builder other) { + return new guru.learningjournal.kafka.examples.types.HadoopRecord.Builder(other); + } + + /** + * Creates a new HadoopRecord RecordBuilder by copying an existing HadoopRecord instance. + * @param other The existing instance to copy. + * @return A new HadoopRecord RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.HadoopRecord.Builder newBuilder(guru.learningjournal.kafka.examples.types.HadoopRecord other) { + return new guru.learningjournal.kafka.examples.types.HadoopRecord.Builder(other); + } + + /** + * RecordBuilder for HadoopRecord instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private java.lang.CharSequence InvoiceNumber; + private java.lang.Long CreatedTime; + private java.lang.CharSequence StoreID; + private java.lang.CharSequence PosID; + private java.lang.CharSequence CustomerType; + private java.lang.CharSequence PaymentMethod; + private java.lang.CharSequence DeliveryType; + private java.lang.CharSequence City; + private java.lang.CharSequence State; + private java.lang.CharSequence PinCode; + private java.lang.CharSequence ItemCode; + private java.lang.CharSequence ItemDescription; + private java.lang.Double ItemPrice; + private java.lang.Integer ItemQty; + private java.lang.Double TotalValue; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.HadoopRecord.Builder other) { + super(other); + if (isValidValue(fields()[0], other.InvoiceNumber)) { + this.InvoiceNumber = data().deepCopy(fields()[0].schema(), other.InvoiceNumber); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.CreatedTime)) { + this.CreatedTime = data().deepCopy(fields()[1].schema(), other.CreatedTime); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.StoreID)) { + this.StoreID = data().deepCopy(fields()[2].schema(), other.StoreID); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.PosID)) { + this.PosID = data().deepCopy(fields()[3].schema(), other.PosID); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.CustomerType)) { + this.CustomerType = data().deepCopy(fields()[4].schema(), other.CustomerType); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.PaymentMethod)) { + this.PaymentMethod = data().deepCopy(fields()[5].schema(), other.PaymentMethod); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.DeliveryType)) { + this.DeliveryType = data().deepCopy(fields()[6].schema(), other.DeliveryType); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.City)) { + this.City = data().deepCopy(fields()[7].schema(), other.City); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.State)) { + this.State = data().deepCopy(fields()[8].schema(), other.State); + fieldSetFlags()[8] = true; + } + if (isValidValue(fields()[9], other.PinCode)) { + this.PinCode = data().deepCopy(fields()[9].schema(), other.PinCode); + fieldSetFlags()[9] = true; + } + if (isValidValue(fields()[10], other.ItemCode)) { + this.ItemCode = data().deepCopy(fields()[10].schema(), other.ItemCode); + fieldSetFlags()[10] = true; + } + if (isValidValue(fields()[11], other.ItemDescription)) { + this.ItemDescription = data().deepCopy(fields()[11].schema(), other.ItemDescription); + fieldSetFlags()[11] = true; + } + if (isValidValue(fields()[12], other.ItemPrice)) { + this.ItemPrice = data().deepCopy(fields()[12].schema(), other.ItemPrice); + fieldSetFlags()[12] = true; + } + if (isValidValue(fields()[13], other.ItemQty)) { + this.ItemQty = data().deepCopy(fields()[13].schema(), other.ItemQty); + fieldSetFlags()[13] = true; + } + if (isValidValue(fields()[14], other.TotalValue)) { + this.TotalValue = data().deepCopy(fields()[14].schema(), other.TotalValue); + fieldSetFlags()[14] = true; + } + } + + /** + * Creates a Builder by copying an existing HadoopRecord instance + * @param other The existing instance to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.HadoopRecord other) { + super(SCHEMA$); + if (isValidValue(fields()[0], other.InvoiceNumber)) { + this.InvoiceNumber = data().deepCopy(fields()[0].schema(), other.InvoiceNumber); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.CreatedTime)) { + this.CreatedTime = data().deepCopy(fields()[1].schema(), other.CreatedTime); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.StoreID)) { + this.StoreID = data().deepCopy(fields()[2].schema(), other.StoreID); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.PosID)) { + this.PosID = data().deepCopy(fields()[3].schema(), other.PosID); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.CustomerType)) { + this.CustomerType = data().deepCopy(fields()[4].schema(), other.CustomerType); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.PaymentMethod)) { + this.PaymentMethod = data().deepCopy(fields()[5].schema(), other.PaymentMethod); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.DeliveryType)) { + this.DeliveryType = data().deepCopy(fields()[6].schema(), other.DeliveryType); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.City)) { + this.City = data().deepCopy(fields()[7].schema(), other.City); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.State)) { + this.State = data().deepCopy(fields()[8].schema(), other.State); + fieldSetFlags()[8] = true; + } + if (isValidValue(fields()[9], other.PinCode)) { + this.PinCode = data().deepCopy(fields()[9].schema(), other.PinCode); + fieldSetFlags()[9] = true; + } + if (isValidValue(fields()[10], other.ItemCode)) { + this.ItemCode = data().deepCopy(fields()[10].schema(), other.ItemCode); + fieldSetFlags()[10] = true; + } + if (isValidValue(fields()[11], other.ItemDescription)) { + this.ItemDescription = data().deepCopy(fields()[11].schema(), other.ItemDescription); + fieldSetFlags()[11] = true; + } + if (isValidValue(fields()[12], other.ItemPrice)) { + this.ItemPrice = data().deepCopy(fields()[12].schema(), other.ItemPrice); + fieldSetFlags()[12] = true; + } + if (isValidValue(fields()[13], other.ItemQty)) { + this.ItemQty = data().deepCopy(fields()[13].schema(), other.ItemQty); + fieldSetFlags()[13] = true; + } + if (isValidValue(fields()[14], other.TotalValue)) { + this.TotalValue = data().deepCopy(fields()[14].schema(), other.TotalValue); + fieldSetFlags()[14] = true; + } + } + + /** + * Gets the value of the 'InvoiceNumber' field. + * @return The value. + */ + public java.lang.CharSequence getInvoiceNumber() { + return InvoiceNumber; + } + + /** + * Sets the value of the 'InvoiceNumber' field. + * @param value The value of 'InvoiceNumber'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setInvoiceNumber(java.lang.CharSequence value) { + validate(fields()[0], value); + this.InvoiceNumber = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'InvoiceNumber' field has been set. + * @return True if the 'InvoiceNumber' field has been set, false otherwise. + */ + public boolean hasInvoiceNumber() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'InvoiceNumber' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearInvoiceNumber() { + InvoiceNumber = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'CreatedTime' field. + * @return The value. + */ + public java.lang.Long getCreatedTime() { + return CreatedTime; + } + + /** + * Sets the value of the 'CreatedTime' field. + * @param value The value of 'CreatedTime'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setCreatedTime(java.lang.Long value) { + validate(fields()[1], value); + this.CreatedTime = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'CreatedTime' field has been set. + * @return True if the 'CreatedTime' field has been set, false otherwise. + */ + public boolean hasCreatedTime() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'CreatedTime' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearCreatedTime() { + CreatedTime = null; + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'StoreID' field. + * @return The value. + */ + public java.lang.CharSequence getStoreID() { + return StoreID; + } + + /** + * Sets the value of the 'StoreID' field. + * @param value The value of 'StoreID'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setStoreID(java.lang.CharSequence value) { + validate(fields()[2], value); + this.StoreID = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'StoreID' field has been set. + * @return True if the 'StoreID' field has been set, false otherwise. + */ + public boolean hasStoreID() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'StoreID' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearStoreID() { + StoreID = null; + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'PosID' field. + * @return The value. + */ + public java.lang.CharSequence getPosID() { + return PosID; + } + + /** + * Sets the value of the 'PosID' field. + * @param value The value of 'PosID'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setPosID(java.lang.CharSequence value) { + validate(fields()[3], value); + this.PosID = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'PosID' field has been set. + * @return True if the 'PosID' field has been set, false otherwise. + */ + public boolean hasPosID() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'PosID' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearPosID() { + PosID = null; + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'CustomerType' field. + * @return The value. + */ + public java.lang.CharSequence getCustomerType() { + return CustomerType; + } + + /** + * Sets the value of the 'CustomerType' field. + * @param value The value of 'CustomerType'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setCustomerType(java.lang.CharSequence value) { + validate(fields()[4], value); + this.CustomerType = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'CustomerType' field has been set. + * @return True if the 'CustomerType' field has been set, false otherwise. + */ + public boolean hasCustomerType() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'CustomerType' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearCustomerType() { + CustomerType = null; + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'PaymentMethod' field. + * @return The value. + */ + public java.lang.CharSequence getPaymentMethod() { + return PaymentMethod; + } + + /** + * Sets the value of the 'PaymentMethod' field. + * @param value The value of 'PaymentMethod'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setPaymentMethod(java.lang.CharSequence value) { + validate(fields()[5], value); + this.PaymentMethod = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'PaymentMethod' field has been set. + * @return True if the 'PaymentMethod' field has been set, false otherwise. + */ + public boolean hasPaymentMethod() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'PaymentMethod' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearPaymentMethod() { + PaymentMethod = null; + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'DeliveryType' field. + * @return The value. + */ + public java.lang.CharSequence getDeliveryType() { + return DeliveryType; + } + + /** + * Sets the value of the 'DeliveryType' field. + * @param value The value of 'DeliveryType'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setDeliveryType(java.lang.CharSequence value) { + validate(fields()[6], value); + this.DeliveryType = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'DeliveryType' field has been set. + * @return True if the 'DeliveryType' field has been set, false otherwise. + */ + public boolean hasDeliveryType() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'DeliveryType' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearDeliveryType() { + DeliveryType = null; + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'City' field. + * @return The value. + */ + public java.lang.CharSequence getCity() { + return City; + } + + /** + * Sets the value of the 'City' field. + * @param value The value of 'City'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setCity(java.lang.CharSequence value) { + validate(fields()[7], value); + this.City = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'City' field has been set. + * @return True if the 'City' field has been set, false otherwise. + */ + public boolean hasCity() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'City' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearCity() { + City = null; + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'State' field. + * @return The value. + */ + public java.lang.CharSequence getState() { + return State; + } + + /** + * Sets the value of the 'State' field. + * @param value The value of 'State'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setState(java.lang.CharSequence value) { + validate(fields()[8], value); + this.State = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'State' field has been set. + * @return True if the 'State' field has been set, false otherwise. + */ + public boolean hasState() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'State' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearState() { + State = null; + fieldSetFlags()[8] = false; + return this; + } + + /** + * Gets the value of the 'PinCode' field. + * @return The value. + */ + public java.lang.CharSequence getPinCode() { + return PinCode; + } + + /** + * Sets the value of the 'PinCode' field. + * @param value The value of 'PinCode'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setPinCode(java.lang.CharSequence value) { + validate(fields()[9], value); + this.PinCode = value; + fieldSetFlags()[9] = true; + return this; + } + + /** + * Checks whether the 'PinCode' field has been set. + * @return True if the 'PinCode' field has been set, false otherwise. + */ + public boolean hasPinCode() { + return fieldSetFlags()[9]; + } + + + /** + * Clears the value of the 'PinCode' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearPinCode() { + PinCode = null; + fieldSetFlags()[9] = false; + return this; + } + + /** + * Gets the value of the 'ItemCode' field. + * @return The value. + */ + public java.lang.CharSequence getItemCode() { + return ItemCode; + } + + /** + * Sets the value of the 'ItemCode' field. + * @param value The value of 'ItemCode'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setItemCode(java.lang.CharSequence value) { + validate(fields()[10], value); + this.ItemCode = value; + fieldSetFlags()[10] = true; + return this; + } + + /** + * Checks whether the 'ItemCode' field has been set. + * @return True if the 'ItemCode' field has been set, false otherwise. + */ + public boolean hasItemCode() { + return fieldSetFlags()[10]; + } + + + /** + * Clears the value of the 'ItemCode' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearItemCode() { + ItemCode = null; + fieldSetFlags()[10] = false; + return this; + } + + /** + * Gets the value of the 'ItemDescription' field. + * @return The value. + */ + public java.lang.CharSequence getItemDescription() { + return ItemDescription; + } + + /** + * Sets the value of the 'ItemDescription' field. + * @param value The value of 'ItemDescription'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setItemDescription(java.lang.CharSequence value) { + validate(fields()[11], value); + this.ItemDescription = value; + fieldSetFlags()[11] = true; + return this; + } + + /** + * Checks whether the 'ItemDescription' field has been set. + * @return True if the 'ItemDescription' field has been set, false otherwise. + */ + public boolean hasItemDescription() { + return fieldSetFlags()[11]; + } + + + /** + * Clears the value of the 'ItemDescription' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearItemDescription() { + ItemDescription = null; + fieldSetFlags()[11] = false; + return this; + } + + /** + * Gets the value of the 'ItemPrice' field. + * @return The value. + */ + public java.lang.Double getItemPrice() { + return ItemPrice; + } + + /** + * Sets the value of the 'ItemPrice' field. + * @param value The value of 'ItemPrice'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setItemPrice(java.lang.Double value) { + validate(fields()[12], value); + this.ItemPrice = value; + fieldSetFlags()[12] = true; + return this; + } + + /** + * Checks whether the 'ItemPrice' field has been set. + * @return True if the 'ItemPrice' field has been set, false otherwise. + */ + public boolean hasItemPrice() { + return fieldSetFlags()[12]; + } + + + /** + * Clears the value of the 'ItemPrice' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearItemPrice() { + ItemPrice = null; + fieldSetFlags()[12] = false; + return this; + } + + /** + * Gets the value of the 'ItemQty' field. + * @return The value. + */ + public java.lang.Integer getItemQty() { + return ItemQty; + } + + /** + * Sets the value of the 'ItemQty' field. + * @param value The value of 'ItemQty'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setItemQty(java.lang.Integer value) { + validate(fields()[13], value); + this.ItemQty = value; + fieldSetFlags()[13] = true; + return this; + } + + /** + * Checks whether the 'ItemQty' field has been set. + * @return True if the 'ItemQty' field has been set, false otherwise. + */ + public boolean hasItemQty() { + return fieldSetFlags()[13]; + } + + + /** + * Clears the value of the 'ItemQty' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearItemQty() { + ItemQty = null; + fieldSetFlags()[13] = false; + return this; + } + + /** + * Gets the value of the 'TotalValue' field. + * @return The value. + */ + public java.lang.Double getTotalValue() { + return TotalValue; + } + + /** + * Sets the value of the 'TotalValue' field. + * @param value The value of 'TotalValue'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder setTotalValue(java.lang.Double value) { + validate(fields()[14], value); + this.TotalValue = value; + fieldSetFlags()[14] = true; + return this; + } + + /** + * Checks whether the 'TotalValue' field has been set. + * @return True if the 'TotalValue' field has been set, false otherwise. + */ + public boolean hasTotalValue() { + return fieldSetFlags()[14]; + } + + + /** + * Clears the value of the 'TotalValue' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.HadoopRecord.Builder clearTotalValue() { + TotalValue = null; + fieldSetFlags()[14] = false; + return this; + } + + @Override + public HadoopRecord build() { + try { + HadoopRecord record = new HadoopRecord(); + record.InvoiceNumber = fieldSetFlags()[0] ? this.InvoiceNumber : (java.lang.CharSequence) defaultValue(fields()[0]); + record.CreatedTime = fieldSetFlags()[1] ? this.CreatedTime : (java.lang.Long) defaultValue(fields()[1]); + record.StoreID = fieldSetFlags()[2] ? this.StoreID : (java.lang.CharSequence) defaultValue(fields()[2]); + record.PosID = fieldSetFlags()[3] ? this.PosID : (java.lang.CharSequence) defaultValue(fields()[3]); + record.CustomerType = fieldSetFlags()[4] ? this.CustomerType : (java.lang.CharSequence) defaultValue(fields()[4]); + record.PaymentMethod = fieldSetFlags()[5] ? this.PaymentMethod : (java.lang.CharSequence) defaultValue(fields()[5]); + record.DeliveryType = fieldSetFlags()[6] ? this.DeliveryType : (java.lang.CharSequence) defaultValue(fields()[6]); + record.City = fieldSetFlags()[7] ? this.City : (java.lang.CharSequence) defaultValue(fields()[7]); + record.State = fieldSetFlags()[8] ? this.State : (java.lang.CharSequence) defaultValue(fields()[8]); + record.PinCode = fieldSetFlags()[9] ? this.PinCode : (java.lang.CharSequence) defaultValue(fields()[9]); + record.ItemCode = fieldSetFlags()[10] ? this.ItemCode : (java.lang.CharSequence) defaultValue(fields()[10]); + record.ItemDescription = fieldSetFlags()[11] ? this.ItemDescription : (java.lang.CharSequence) defaultValue(fields()[11]); + record.ItemPrice = fieldSetFlags()[12] ? this.ItemPrice : (java.lang.Double) defaultValue(fields()[12]); + record.ItemQty = fieldSetFlags()[13] ? this.ItemQty : (java.lang.Integer) defaultValue(fields()[13]); + record.TotalValue = fieldSetFlags()[14] ? this.TotalValue : (java.lang.Double) defaultValue(fields()[14]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + private static final org.apache.avro.io.DatumWriter + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + private static final org.apache.avro.io.DatumReader + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + +} diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/Notification.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/Notification.java new file mode 100644 index 0000000..73dfa56 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/Notification.java @@ -0,0 +1,407 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package guru.learningjournal.kafka.examples.types; + +import org.apache.avro.specific.SpecificData; + +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class Notification extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -5095288617407199915L; + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Notification\",\"namespace\":\"guru.learningjournal.kafka.examples.types\",\"fields\":[{\"name\":\"InvoiceNumber\",\"type\":[\"null\",\"string\"]},{\"name\":\"CustomerCardNo\",\"type\":[\"null\",\"string\"]},{\"name\":\"TotalAmount\",\"type\":[\"null\",\"double\"]},{\"name\":\"EarnedLoyaltyPoints\",\"type\":[\"null\",\"double\"]}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + @Deprecated public java.lang.CharSequence InvoiceNumber; + @Deprecated public java.lang.CharSequence CustomerCardNo; + @Deprecated public java.lang.Double TotalAmount; + @Deprecated public java.lang.Double EarnedLoyaltyPoints; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use newBuilder(). + */ + public Notification() {} + + /** + * All-args constructor. + * @param InvoiceNumber The new value for InvoiceNumber + * @param CustomerCardNo The new value for CustomerCardNo + * @param TotalAmount The new value for TotalAmount + * @param EarnedLoyaltyPoints The new value for EarnedLoyaltyPoints + */ + public Notification(java.lang.CharSequence InvoiceNumber, java.lang.CharSequence CustomerCardNo, java.lang.Double TotalAmount, java.lang.Double EarnedLoyaltyPoints) { + this.InvoiceNumber = InvoiceNumber; + this.CustomerCardNo = CustomerCardNo; + this.TotalAmount = TotalAmount; + this.EarnedLoyaltyPoints = EarnedLoyaltyPoints; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return InvoiceNumber; + case 1: return CustomerCardNo; + case 2: return TotalAmount; + case 3: return EarnedLoyaltyPoints; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: InvoiceNumber = (java.lang.CharSequence)value$; break; + case 1: CustomerCardNo = (java.lang.CharSequence)value$; break; + case 2: TotalAmount = (java.lang.Double)value$; break; + case 3: EarnedLoyaltyPoints = (java.lang.Double)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'InvoiceNumber' field. + * @return The value of the 'InvoiceNumber' field. + */ + public java.lang.CharSequence getInvoiceNumber() { + return InvoiceNumber; + } + + /** + * Sets the value of the 'InvoiceNumber' field. + * @param value the value to set. + */ + public void setInvoiceNumber(java.lang.CharSequence value) { + this.InvoiceNumber = value; + } + + /** + * Gets the value of the 'CustomerCardNo' field. + * @return The value of the 'CustomerCardNo' field. + */ + public java.lang.CharSequence getCustomerCardNo() { + return CustomerCardNo; + } + + /** + * Sets the value of the 'CustomerCardNo' field. + * @param value the value to set. + */ + public void setCustomerCardNo(java.lang.CharSequence value) { + this.CustomerCardNo = value; + } + + /** + * Gets the value of the 'TotalAmount' field. + * @return The value of the 'TotalAmount' field. + */ + public java.lang.Double getTotalAmount() { + return TotalAmount; + } + + /** + * Sets the value of the 'TotalAmount' field. + * @param value the value to set. + */ + public void setTotalAmount(java.lang.Double value) { + this.TotalAmount = value; + } + + /** + * Gets the value of the 'EarnedLoyaltyPoints' field. + * @return The value of the 'EarnedLoyaltyPoints' field. + */ + public java.lang.Double getEarnedLoyaltyPoints() { + return EarnedLoyaltyPoints; + } + + /** + * Sets the value of the 'EarnedLoyaltyPoints' field. + * @param value the value to set. + */ + public void setEarnedLoyaltyPoints(java.lang.Double value) { + this.EarnedLoyaltyPoints = value; + } + + /** + * Creates a new Notification RecordBuilder. + * @return A new Notification RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.Notification.Builder newBuilder() { + return new guru.learningjournal.kafka.examples.types.Notification.Builder(); + } + + /** + * Creates a new Notification RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new Notification RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.Notification.Builder newBuilder(guru.learningjournal.kafka.examples.types.Notification.Builder other) { + return new guru.learningjournal.kafka.examples.types.Notification.Builder(other); + } + + /** + * Creates a new Notification RecordBuilder by copying an existing Notification instance. + * @param other The existing instance to copy. + * @return A new Notification RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.Notification.Builder newBuilder(guru.learningjournal.kafka.examples.types.Notification other) { + return new guru.learningjournal.kafka.examples.types.Notification.Builder(other); + } + + /** + * RecordBuilder for Notification instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private java.lang.CharSequence InvoiceNumber; + private java.lang.CharSequence CustomerCardNo; + private java.lang.Double TotalAmount; + private java.lang.Double EarnedLoyaltyPoints; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.Notification.Builder other) { + super(other); + if (isValidValue(fields()[0], other.InvoiceNumber)) { + this.InvoiceNumber = data().deepCopy(fields()[0].schema(), other.InvoiceNumber); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.CustomerCardNo)) { + this.CustomerCardNo = data().deepCopy(fields()[1].schema(), other.CustomerCardNo); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.TotalAmount)) { + this.TotalAmount = data().deepCopy(fields()[2].schema(), other.TotalAmount); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.EarnedLoyaltyPoints)) { + this.EarnedLoyaltyPoints = data().deepCopy(fields()[3].schema(), other.EarnedLoyaltyPoints); + fieldSetFlags()[3] = true; + } + } + + /** + * Creates a Builder by copying an existing Notification instance + * @param other The existing instance to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.Notification other) { + super(SCHEMA$); + if (isValidValue(fields()[0], other.InvoiceNumber)) { + this.InvoiceNumber = data().deepCopy(fields()[0].schema(), other.InvoiceNumber); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.CustomerCardNo)) { + this.CustomerCardNo = data().deepCopy(fields()[1].schema(), other.CustomerCardNo); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.TotalAmount)) { + this.TotalAmount = data().deepCopy(fields()[2].schema(), other.TotalAmount); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.EarnedLoyaltyPoints)) { + this.EarnedLoyaltyPoints = data().deepCopy(fields()[3].schema(), other.EarnedLoyaltyPoints); + fieldSetFlags()[3] = true; + } + } + + /** + * Gets the value of the 'InvoiceNumber' field. + * @return The value. + */ + public java.lang.CharSequence getInvoiceNumber() { + return InvoiceNumber; + } + + /** + * Sets the value of the 'InvoiceNumber' field. + * @param value The value of 'InvoiceNumber'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder setInvoiceNumber(java.lang.CharSequence value) { + validate(fields()[0], value); + this.InvoiceNumber = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'InvoiceNumber' field has been set. + * @return True if the 'InvoiceNumber' field has been set, false otherwise. + */ + public boolean hasInvoiceNumber() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'InvoiceNumber' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder clearInvoiceNumber() { + InvoiceNumber = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'CustomerCardNo' field. + * @return The value. + */ + public java.lang.CharSequence getCustomerCardNo() { + return CustomerCardNo; + } + + /** + * Sets the value of the 'CustomerCardNo' field. + * @param value The value of 'CustomerCardNo'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder setCustomerCardNo(java.lang.CharSequence value) { + validate(fields()[1], value); + this.CustomerCardNo = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'CustomerCardNo' field has been set. + * @return True if the 'CustomerCardNo' field has been set, false otherwise. + */ + public boolean hasCustomerCardNo() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'CustomerCardNo' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder clearCustomerCardNo() { + CustomerCardNo = null; + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'TotalAmount' field. + * @return The value. + */ + public java.lang.Double getTotalAmount() { + return TotalAmount; + } + + /** + * Sets the value of the 'TotalAmount' field. + * @param value The value of 'TotalAmount'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder setTotalAmount(java.lang.Double value) { + validate(fields()[2], value); + this.TotalAmount = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'TotalAmount' field has been set. + * @return True if the 'TotalAmount' field has been set, false otherwise. + */ + public boolean hasTotalAmount() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'TotalAmount' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder clearTotalAmount() { + TotalAmount = null; + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'EarnedLoyaltyPoints' field. + * @return The value. + */ + public java.lang.Double getEarnedLoyaltyPoints() { + return EarnedLoyaltyPoints; + } + + /** + * Sets the value of the 'EarnedLoyaltyPoints' field. + * @param value The value of 'EarnedLoyaltyPoints'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder setEarnedLoyaltyPoints(java.lang.Double value) { + validate(fields()[3], value); + this.EarnedLoyaltyPoints = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'EarnedLoyaltyPoints' field has been set. + * @return True if the 'EarnedLoyaltyPoints' field has been set, false otherwise. + */ + public boolean hasEarnedLoyaltyPoints() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'EarnedLoyaltyPoints' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.Notification.Builder clearEarnedLoyaltyPoints() { + EarnedLoyaltyPoints = null; + fieldSetFlags()[3] = false; + return this; + } + + @Override + public Notification build() { + try { + Notification record = new Notification(); + record.InvoiceNumber = fieldSetFlags()[0] ? this.InvoiceNumber : (java.lang.CharSequence) defaultValue(fields()[0]); + record.CustomerCardNo = fieldSetFlags()[1] ? this.CustomerCardNo : (java.lang.CharSequence) defaultValue(fields()[1]); + record.TotalAmount = fieldSetFlags()[2] ? this.TotalAmount : (java.lang.Double) defaultValue(fields()[2]); + record.EarnedLoyaltyPoints = fieldSetFlags()[3] ? this.EarnedLoyaltyPoints : (java.lang.Double) defaultValue(fields()[3]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + private static final org.apache.avro.io.DatumWriter + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + private static final org.apache.avro.io.DatumReader + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + +} diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/PosInvoice.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/PosInvoice.java new file mode 100644 index 0000000..9e9f966 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/PosInvoice.java @@ -0,0 +1,1361 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package guru.learningjournal.kafka.examples.types; + +import org.apache.avro.specific.SpecificData; + +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class PosInvoice extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -8112144139664527057L; + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"PosInvoice\",\"namespace\":\"guru.learningjournal.kafka.examples.types\",\"fields\":[{\"name\":\"InvoiceNumber\",\"type\":[\"null\",\"string\"]},{\"name\":\"CreatedTime\",\"type\":[\"null\",\"long\"]},{\"name\":\"StoreID\",\"type\":[\"null\",\"string\"]},{\"name\":\"PosID\",\"type\":[\"null\",\"string\"]},{\"name\":\"CashierID\",\"type\":[\"null\",\"string\"]},{\"name\":\"CustomerType\",\"type\":[\"null\",\"string\"]},{\"name\":\"CustomerCardNo\",\"type\":[\"null\",\"string\"]},{\"name\":\"TotalAmount\",\"type\":[\"null\",\"double\"]},{\"name\":\"NumberOfItems\",\"type\":[\"null\",\"int\"]},{\"name\":\"PaymentMethod\",\"type\":[\"null\",\"string\"]},{\"name\":\"TaxableAmount\",\"type\":[\"null\",\"double\"]},{\"name\":\"CGST\",\"type\":[\"null\",\"double\"]},{\"name\":\"SGST\",\"type\":[\"null\",\"double\"]},{\"name\":\"CESS\",\"type\":[\"null\",\"double\"]},{\"name\":\"DeliveryType\",\"type\":[\"null\",\"string\"]},{\"name\":\"DeliveryAddress\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"DeliveryAddress\",\"fields\":[{\"name\":\"AddressLine\",\"type\":[\"null\",\"string\"]},{\"name\":\"City\",\"type\":[\"null\",\"string\"]},{\"name\":\"State\",\"type\":[\"null\",\"string\"]},{\"name\":\"PinCode\",\"type\":[\"null\",\"string\"]},{\"name\":\"ContactNumber\",\"type\":[\"null\",\"string\"]}]}]},{\"name\":\"InvoiceLineItems\",\"type\":[\"null\",{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"PosLineItem\",\"fields\":[{\"name\":\"ItemCode\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemDescription\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemPrice\",\"type\":[\"null\",\"double\"]},{\"name\":\"ItemQty\",\"type\":[\"null\",\"int\"]},{\"name\":\"TotalValue\",\"type\":[\"null\",\"double\"]}]}}]}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + @Deprecated public java.lang.CharSequence InvoiceNumber; + @Deprecated public java.lang.Long CreatedTime; + @Deprecated public java.lang.CharSequence StoreID; + @Deprecated public java.lang.CharSequence PosID; + @Deprecated public java.lang.CharSequence CashierID; + @Deprecated public java.lang.CharSequence CustomerType; + @Deprecated public java.lang.CharSequence CustomerCardNo; + @Deprecated public java.lang.Double TotalAmount; + @Deprecated public java.lang.Integer NumberOfItems; + @Deprecated public java.lang.CharSequence PaymentMethod; + @Deprecated public java.lang.Double TaxableAmount; + @Deprecated public java.lang.Double CGST; + @Deprecated public java.lang.Double SGST; + @Deprecated public java.lang.Double CESS; + @Deprecated public java.lang.CharSequence DeliveryType; + @Deprecated public guru.learningjournal.kafka.examples.types.DeliveryAddress DeliveryAddress; + @Deprecated public java.util.List InvoiceLineItems; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use newBuilder(). + */ + public PosInvoice() {} + + /** + * All-args constructor. + * @param InvoiceNumber The new value for InvoiceNumber + * @param CreatedTime The new value for CreatedTime + * @param StoreID The new value for StoreID + * @param PosID The new value for PosID + * @param CashierID The new value for CashierID + * @param CustomerType The new value for CustomerType + * @param CustomerCardNo The new value for CustomerCardNo + * @param TotalAmount The new value for TotalAmount + * @param NumberOfItems The new value for NumberOfItems + * @param PaymentMethod The new value for PaymentMethod + * @param TaxableAmount The new value for TaxableAmount + * @param CGST The new value for CGST + * @param SGST The new value for SGST + * @param CESS The new value for CESS + * @param DeliveryType The new value for DeliveryType + * @param DeliveryAddress The new value for DeliveryAddress + * @param InvoiceLineItems The new value for InvoiceLineItems + */ + public PosInvoice(java.lang.CharSequence InvoiceNumber, java.lang.Long CreatedTime, java.lang.CharSequence StoreID, java.lang.CharSequence PosID, java.lang.CharSequence CashierID, java.lang.CharSequence CustomerType, java.lang.CharSequence CustomerCardNo, java.lang.Double TotalAmount, java.lang.Integer NumberOfItems, java.lang.CharSequence PaymentMethod, java.lang.Double TaxableAmount, java.lang.Double CGST, java.lang.Double SGST, java.lang.Double CESS, java.lang.CharSequence DeliveryType, guru.learningjournal.kafka.examples.types.DeliveryAddress DeliveryAddress, java.util.List InvoiceLineItems) { + this.InvoiceNumber = InvoiceNumber; + this.CreatedTime = CreatedTime; + this.StoreID = StoreID; + this.PosID = PosID; + this.CashierID = CashierID; + this.CustomerType = CustomerType; + this.CustomerCardNo = CustomerCardNo; + this.TotalAmount = TotalAmount; + this.NumberOfItems = NumberOfItems; + this.PaymentMethod = PaymentMethod; + this.TaxableAmount = TaxableAmount; + this.CGST = CGST; + this.SGST = SGST; + this.CESS = CESS; + this.DeliveryType = DeliveryType; + this.DeliveryAddress = DeliveryAddress; + this.InvoiceLineItems = InvoiceLineItems; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return InvoiceNumber; + case 1: return CreatedTime; + case 2: return StoreID; + case 3: return PosID; + case 4: return CashierID; + case 5: return CustomerType; + case 6: return CustomerCardNo; + case 7: return TotalAmount; + case 8: return NumberOfItems; + case 9: return PaymentMethod; + case 10: return TaxableAmount; + case 11: return CGST; + case 12: return SGST; + case 13: return CESS; + case 14: return DeliveryType; + case 15: return DeliveryAddress; + case 16: return InvoiceLineItems; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: InvoiceNumber = (java.lang.CharSequence)value$; break; + case 1: CreatedTime = (java.lang.Long)value$; break; + case 2: StoreID = (java.lang.CharSequence)value$; break; + case 3: PosID = (java.lang.CharSequence)value$; break; + case 4: CashierID = (java.lang.CharSequence)value$; break; + case 5: CustomerType = (java.lang.CharSequence)value$; break; + case 6: CustomerCardNo = (java.lang.CharSequence)value$; break; + case 7: TotalAmount = (java.lang.Double)value$; break; + case 8: NumberOfItems = (java.lang.Integer)value$; break; + case 9: PaymentMethod = (java.lang.CharSequence)value$; break; + case 10: TaxableAmount = (java.lang.Double)value$; break; + case 11: CGST = (java.lang.Double)value$; break; + case 12: SGST = (java.lang.Double)value$; break; + case 13: CESS = (java.lang.Double)value$; break; + case 14: DeliveryType = (java.lang.CharSequence)value$; break; + case 15: DeliveryAddress = (guru.learningjournal.kafka.examples.types.DeliveryAddress)value$; break; + case 16: InvoiceLineItems = (java.util.List)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'InvoiceNumber' field. + * @return The value of the 'InvoiceNumber' field. + */ + public java.lang.CharSequence getInvoiceNumber() { + return InvoiceNumber; + } + + /** + * Sets the value of the 'InvoiceNumber' field. + * @param value the value to set. + */ + public void setInvoiceNumber(java.lang.CharSequence value) { + this.InvoiceNumber = value; + } + + /** + * Gets the value of the 'CreatedTime' field. + * @return The value of the 'CreatedTime' field. + */ + public java.lang.Long getCreatedTime() { + return CreatedTime; + } + + /** + * Sets the value of the 'CreatedTime' field. + * @param value the value to set. + */ + public void setCreatedTime(java.lang.Long value) { + this.CreatedTime = value; + } + + /** + * Gets the value of the 'StoreID' field. + * @return The value of the 'StoreID' field. + */ + public java.lang.CharSequence getStoreID() { + return StoreID; + } + + /** + * Sets the value of the 'StoreID' field. + * @param value the value to set. + */ + public void setStoreID(java.lang.CharSequence value) { + this.StoreID = value; + } + + /** + * Gets the value of the 'PosID' field. + * @return The value of the 'PosID' field. + */ + public java.lang.CharSequence getPosID() { + return PosID; + } + + /** + * Sets the value of the 'PosID' field. + * @param value the value to set. + */ + public void setPosID(java.lang.CharSequence value) { + this.PosID = value; + } + + /** + * Gets the value of the 'CashierID' field. + * @return The value of the 'CashierID' field. + */ + public java.lang.CharSequence getCashierID() { + return CashierID; + } + + /** + * Sets the value of the 'CashierID' field. + * @param value the value to set. + */ + public void setCashierID(java.lang.CharSequence value) { + this.CashierID = value; + } + + /** + * Gets the value of the 'CustomerType' field. + * @return The value of the 'CustomerType' field. + */ + public java.lang.CharSequence getCustomerType() { + return CustomerType; + } + + /** + * Sets the value of the 'CustomerType' field. + * @param value the value to set. + */ + public void setCustomerType(java.lang.CharSequence value) { + this.CustomerType = value; + } + + /** + * Gets the value of the 'CustomerCardNo' field. + * @return The value of the 'CustomerCardNo' field. + */ + public java.lang.CharSequence getCustomerCardNo() { + return CustomerCardNo; + } + + /** + * Sets the value of the 'CustomerCardNo' field. + * @param value the value to set. + */ + public void setCustomerCardNo(java.lang.CharSequence value) { + this.CustomerCardNo = value; + } + + /** + * Gets the value of the 'TotalAmount' field. + * @return The value of the 'TotalAmount' field. + */ + public java.lang.Double getTotalAmount() { + return TotalAmount; + } + + /** + * Sets the value of the 'TotalAmount' field. + * @param value the value to set. + */ + public void setTotalAmount(java.lang.Double value) { + this.TotalAmount = value; + } + + /** + * Gets the value of the 'NumberOfItems' field. + * @return The value of the 'NumberOfItems' field. + */ + public java.lang.Integer getNumberOfItems() { + return NumberOfItems; + } + + /** + * Sets the value of the 'NumberOfItems' field. + * @param value the value to set. + */ + public void setNumberOfItems(java.lang.Integer value) { + this.NumberOfItems = value; + } + + /** + * Gets the value of the 'PaymentMethod' field. + * @return The value of the 'PaymentMethod' field. + */ + public java.lang.CharSequence getPaymentMethod() { + return PaymentMethod; + } + + /** + * Sets the value of the 'PaymentMethod' field. + * @param value the value to set. + */ + public void setPaymentMethod(java.lang.CharSequence value) { + this.PaymentMethod = value; + } + + /** + * Gets the value of the 'TaxableAmount' field. + * @return The value of the 'TaxableAmount' field. + */ + public java.lang.Double getTaxableAmount() { + return TaxableAmount; + } + + /** + * Sets the value of the 'TaxableAmount' field. + * @param value the value to set. + */ + public void setTaxableAmount(java.lang.Double value) { + this.TaxableAmount = value; + } + + /** + * Gets the value of the 'CGST' field. + * @return The value of the 'CGST' field. + */ + public java.lang.Double getCGST() { + return CGST; + } + + /** + * Sets the value of the 'CGST' field. + * @param value the value to set. + */ + public void setCGST(java.lang.Double value) { + this.CGST = value; + } + + /** + * Gets the value of the 'SGST' field. + * @return The value of the 'SGST' field. + */ + public java.lang.Double getSGST() { + return SGST; + } + + /** + * Sets the value of the 'SGST' field. + * @param value the value to set. + */ + public void setSGST(java.lang.Double value) { + this.SGST = value; + } + + /** + * Gets the value of the 'CESS' field. + * @return The value of the 'CESS' field. + */ + public java.lang.Double getCESS() { + return CESS; + } + + /** + * Sets the value of the 'CESS' field. + * @param value the value to set. + */ + public void setCESS(java.lang.Double value) { + this.CESS = value; + } + + /** + * Gets the value of the 'DeliveryType' field. + * @return The value of the 'DeliveryType' field. + */ + public java.lang.CharSequence getDeliveryType() { + return DeliveryType; + } + + /** + * Sets the value of the 'DeliveryType' field. + * @param value the value to set. + */ + public void setDeliveryType(java.lang.CharSequence value) { + this.DeliveryType = value; + } + + /** + * Gets the value of the 'DeliveryAddress' field. + * @return The value of the 'DeliveryAddress' field. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress getDeliveryAddress() { + return DeliveryAddress; + } + + /** + * Sets the value of the 'DeliveryAddress' field. + * @param value the value to set. + */ + public void setDeliveryAddress(guru.learningjournal.kafka.examples.types.DeliveryAddress value) { + this.DeliveryAddress = value; + } + + /** + * Gets the value of the 'InvoiceLineItems' field. + * @return The value of the 'InvoiceLineItems' field. + */ + public java.util.List getInvoiceLineItems() { + return InvoiceLineItems; + } + + /** + * Sets the value of the 'InvoiceLineItems' field. + * @param value the value to set. + */ + public void setInvoiceLineItems(java.util.List value) { + this.InvoiceLineItems = value; + } + + /** + * Creates a new PosInvoice RecordBuilder. + * @return A new PosInvoice RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.PosInvoice.Builder newBuilder() { + return new guru.learningjournal.kafka.examples.types.PosInvoice.Builder(); + } + + /** + * Creates a new PosInvoice RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new PosInvoice RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.PosInvoice.Builder newBuilder(guru.learningjournal.kafka.examples.types.PosInvoice.Builder other) { + return new guru.learningjournal.kafka.examples.types.PosInvoice.Builder(other); + } + + /** + * Creates a new PosInvoice RecordBuilder by copying an existing PosInvoice instance. + * @param other The existing instance to copy. + * @return A new PosInvoice RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.PosInvoice.Builder newBuilder(guru.learningjournal.kafka.examples.types.PosInvoice other) { + return new guru.learningjournal.kafka.examples.types.PosInvoice.Builder(other); + } + + /** + * RecordBuilder for PosInvoice instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private java.lang.CharSequence InvoiceNumber; + private java.lang.Long CreatedTime; + private java.lang.CharSequence StoreID; + private java.lang.CharSequence PosID; + private java.lang.CharSequence CashierID; + private java.lang.CharSequence CustomerType; + private java.lang.CharSequence CustomerCardNo; + private java.lang.Double TotalAmount; + private java.lang.Integer NumberOfItems; + private java.lang.CharSequence PaymentMethod; + private java.lang.Double TaxableAmount; + private java.lang.Double CGST; + private java.lang.Double SGST; + private java.lang.Double CESS; + private java.lang.CharSequence DeliveryType; + private guru.learningjournal.kafka.examples.types.DeliveryAddress DeliveryAddress; + private guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder DeliveryAddressBuilder; + private java.util.List InvoiceLineItems; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.PosInvoice.Builder other) { + super(other); + if (isValidValue(fields()[0], other.InvoiceNumber)) { + this.InvoiceNumber = data().deepCopy(fields()[0].schema(), other.InvoiceNumber); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.CreatedTime)) { + this.CreatedTime = data().deepCopy(fields()[1].schema(), other.CreatedTime); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.StoreID)) { + this.StoreID = data().deepCopy(fields()[2].schema(), other.StoreID); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.PosID)) { + this.PosID = data().deepCopy(fields()[3].schema(), other.PosID); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.CashierID)) { + this.CashierID = data().deepCopy(fields()[4].schema(), other.CashierID); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.CustomerType)) { + this.CustomerType = data().deepCopy(fields()[5].schema(), other.CustomerType); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.CustomerCardNo)) { + this.CustomerCardNo = data().deepCopy(fields()[6].schema(), other.CustomerCardNo); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.TotalAmount)) { + this.TotalAmount = data().deepCopy(fields()[7].schema(), other.TotalAmount); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.NumberOfItems)) { + this.NumberOfItems = data().deepCopy(fields()[8].schema(), other.NumberOfItems); + fieldSetFlags()[8] = true; + } + if (isValidValue(fields()[9], other.PaymentMethod)) { + this.PaymentMethod = data().deepCopy(fields()[9].schema(), other.PaymentMethod); + fieldSetFlags()[9] = true; + } + if (isValidValue(fields()[10], other.TaxableAmount)) { + this.TaxableAmount = data().deepCopy(fields()[10].schema(), other.TaxableAmount); + fieldSetFlags()[10] = true; + } + if (isValidValue(fields()[11], other.CGST)) { + this.CGST = data().deepCopy(fields()[11].schema(), other.CGST); + fieldSetFlags()[11] = true; + } + if (isValidValue(fields()[12], other.SGST)) { + this.SGST = data().deepCopy(fields()[12].schema(), other.SGST); + fieldSetFlags()[12] = true; + } + if (isValidValue(fields()[13], other.CESS)) { + this.CESS = data().deepCopy(fields()[13].schema(), other.CESS); + fieldSetFlags()[13] = true; + } + if (isValidValue(fields()[14], other.DeliveryType)) { + this.DeliveryType = data().deepCopy(fields()[14].schema(), other.DeliveryType); + fieldSetFlags()[14] = true; + } + if (isValidValue(fields()[15], other.DeliveryAddress)) { + this.DeliveryAddress = data().deepCopy(fields()[15].schema(), other.DeliveryAddress); + fieldSetFlags()[15] = true; + } + if (other.hasDeliveryAddressBuilder()) { + this.DeliveryAddressBuilder = guru.learningjournal.kafka.examples.types.DeliveryAddress.newBuilder(other.getDeliveryAddressBuilder()); + } + if (isValidValue(fields()[16], other.InvoiceLineItems)) { + this.InvoiceLineItems = data().deepCopy(fields()[16].schema(), other.InvoiceLineItems); + fieldSetFlags()[16] = true; + } + } + + /** + * Creates a Builder by copying an existing PosInvoice instance + * @param other The existing instance to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.PosInvoice other) { + super(SCHEMA$); + if (isValidValue(fields()[0], other.InvoiceNumber)) { + this.InvoiceNumber = data().deepCopy(fields()[0].schema(), other.InvoiceNumber); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.CreatedTime)) { + this.CreatedTime = data().deepCopy(fields()[1].schema(), other.CreatedTime); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.StoreID)) { + this.StoreID = data().deepCopy(fields()[2].schema(), other.StoreID); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.PosID)) { + this.PosID = data().deepCopy(fields()[3].schema(), other.PosID); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.CashierID)) { + this.CashierID = data().deepCopy(fields()[4].schema(), other.CashierID); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.CustomerType)) { + this.CustomerType = data().deepCopy(fields()[5].schema(), other.CustomerType); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.CustomerCardNo)) { + this.CustomerCardNo = data().deepCopy(fields()[6].schema(), other.CustomerCardNo); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.TotalAmount)) { + this.TotalAmount = data().deepCopy(fields()[7].schema(), other.TotalAmount); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.NumberOfItems)) { + this.NumberOfItems = data().deepCopy(fields()[8].schema(), other.NumberOfItems); + fieldSetFlags()[8] = true; + } + if (isValidValue(fields()[9], other.PaymentMethod)) { + this.PaymentMethod = data().deepCopy(fields()[9].schema(), other.PaymentMethod); + fieldSetFlags()[9] = true; + } + if (isValidValue(fields()[10], other.TaxableAmount)) { + this.TaxableAmount = data().deepCopy(fields()[10].schema(), other.TaxableAmount); + fieldSetFlags()[10] = true; + } + if (isValidValue(fields()[11], other.CGST)) { + this.CGST = data().deepCopy(fields()[11].schema(), other.CGST); + fieldSetFlags()[11] = true; + } + if (isValidValue(fields()[12], other.SGST)) { + this.SGST = data().deepCopy(fields()[12].schema(), other.SGST); + fieldSetFlags()[12] = true; + } + if (isValidValue(fields()[13], other.CESS)) { + this.CESS = data().deepCopy(fields()[13].schema(), other.CESS); + fieldSetFlags()[13] = true; + } + if (isValidValue(fields()[14], other.DeliveryType)) { + this.DeliveryType = data().deepCopy(fields()[14].schema(), other.DeliveryType); + fieldSetFlags()[14] = true; + } + if (isValidValue(fields()[15], other.DeliveryAddress)) { + this.DeliveryAddress = data().deepCopy(fields()[15].schema(), other.DeliveryAddress); + fieldSetFlags()[15] = true; + } + this.DeliveryAddressBuilder = null; + if (isValidValue(fields()[16], other.InvoiceLineItems)) { + this.InvoiceLineItems = data().deepCopy(fields()[16].schema(), other.InvoiceLineItems); + fieldSetFlags()[16] = true; + } + } + + /** + * Gets the value of the 'InvoiceNumber' field. + * @return The value. + */ + public java.lang.CharSequence getInvoiceNumber() { + return InvoiceNumber; + } + + /** + * Sets the value of the 'InvoiceNumber' field. + * @param value The value of 'InvoiceNumber'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setInvoiceNumber(java.lang.CharSequence value) { + validate(fields()[0], value); + this.InvoiceNumber = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'InvoiceNumber' field has been set. + * @return True if the 'InvoiceNumber' field has been set, false otherwise. + */ + public boolean hasInvoiceNumber() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'InvoiceNumber' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearInvoiceNumber() { + InvoiceNumber = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'CreatedTime' field. + * @return The value. + */ + public java.lang.Long getCreatedTime() { + return CreatedTime; + } + + /** + * Sets the value of the 'CreatedTime' field. + * @param value The value of 'CreatedTime'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setCreatedTime(java.lang.Long value) { + validate(fields()[1], value); + this.CreatedTime = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'CreatedTime' field has been set. + * @return True if the 'CreatedTime' field has been set, false otherwise. + */ + public boolean hasCreatedTime() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'CreatedTime' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearCreatedTime() { + CreatedTime = null; + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'StoreID' field. + * @return The value. + */ + public java.lang.CharSequence getStoreID() { + return StoreID; + } + + /** + * Sets the value of the 'StoreID' field. + * @param value The value of 'StoreID'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setStoreID(java.lang.CharSequence value) { + validate(fields()[2], value); + this.StoreID = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'StoreID' field has been set. + * @return True if the 'StoreID' field has been set, false otherwise. + */ + public boolean hasStoreID() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'StoreID' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearStoreID() { + StoreID = null; + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'PosID' field. + * @return The value. + */ + public java.lang.CharSequence getPosID() { + return PosID; + } + + /** + * Sets the value of the 'PosID' field. + * @param value The value of 'PosID'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setPosID(java.lang.CharSequence value) { + validate(fields()[3], value); + this.PosID = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'PosID' field has been set. + * @return True if the 'PosID' field has been set, false otherwise. + */ + public boolean hasPosID() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'PosID' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearPosID() { + PosID = null; + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'CashierID' field. + * @return The value. + */ + public java.lang.CharSequence getCashierID() { + return CashierID; + } + + /** + * Sets the value of the 'CashierID' field. + * @param value The value of 'CashierID'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setCashierID(java.lang.CharSequence value) { + validate(fields()[4], value); + this.CashierID = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'CashierID' field has been set. + * @return True if the 'CashierID' field has been set, false otherwise. + */ + public boolean hasCashierID() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'CashierID' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearCashierID() { + CashierID = null; + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 'CustomerType' field. + * @return The value. + */ + public java.lang.CharSequence getCustomerType() { + return CustomerType; + } + + /** + * Sets the value of the 'CustomerType' field. + * @param value The value of 'CustomerType'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setCustomerType(java.lang.CharSequence value) { + validate(fields()[5], value); + this.CustomerType = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 'CustomerType' field has been set. + * @return True if the 'CustomerType' field has been set, false otherwise. + */ + public boolean hasCustomerType() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 'CustomerType' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearCustomerType() { + CustomerType = null; + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'CustomerCardNo' field. + * @return The value. + */ + public java.lang.CharSequence getCustomerCardNo() { + return CustomerCardNo; + } + + /** + * Sets the value of the 'CustomerCardNo' field. + * @param value The value of 'CustomerCardNo'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setCustomerCardNo(java.lang.CharSequence value) { + validate(fields()[6], value); + this.CustomerCardNo = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'CustomerCardNo' field has been set. + * @return True if the 'CustomerCardNo' field has been set, false otherwise. + */ + public boolean hasCustomerCardNo() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'CustomerCardNo' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearCustomerCardNo() { + CustomerCardNo = null; + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 'TotalAmount' field. + * @return The value. + */ + public java.lang.Double getTotalAmount() { + return TotalAmount; + } + + /** + * Sets the value of the 'TotalAmount' field. + * @param value The value of 'TotalAmount'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setTotalAmount(java.lang.Double value) { + validate(fields()[7], value); + this.TotalAmount = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 'TotalAmount' field has been set. + * @return True if the 'TotalAmount' field has been set, false otherwise. + */ + public boolean hasTotalAmount() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 'TotalAmount' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearTotalAmount() { + TotalAmount = null; + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'NumberOfItems' field. + * @return The value. + */ + public java.lang.Integer getNumberOfItems() { + return NumberOfItems; + } + + /** + * Sets the value of the 'NumberOfItems' field. + * @param value The value of 'NumberOfItems'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setNumberOfItems(java.lang.Integer value) { + validate(fields()[8], value); + this.NumberOfItems = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'NumberOfItems' field has been set. + * @return True if the 'NumberOfItems' field has been set, false otherwise. + */ + public boolean hasNumberOfItems() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'NumberOfItems' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearNumberOfItems() { + NumberOfItems = null; + fieldSetFlags()[8] = false; + return this; + } + + /** + * Gets the value of the 'PaymentMethod' field. + * @return The value. + */ + public java.lang.CharSequence getPaymentMethod() { + return PaymentMethod; + } + + /** + * Sets the value of the 'PaymentMethod' field. + * @param value The value of 'PaymentMethod'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setPaymentMethod(java.lang.CharSequence value) { + validate(fields()[9], value); + this.PaymentMethod = value; + fieldSetFlags()[9] = true; + return this; + } + + /** + * Checks whether the 'PaymentMethod' field has been set. + * @return True if the 'PaymentMethod' field has been set, false otherwise. + */ + public boolean hasPaymentMethod() { + return fieldSetFlags()[9]; + } + + + /** + * Clears the value of the 'PaymentMethod' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearPaymentMethod() { + PaymentMethod = null; + fieldSetFlags()[9] = false; + return this; + } + + /** + * Gets the value of the 'TaxableAmount' field. + * @return The value. + */ + public java.lang.Double getTaxableAmount() { + return TaxableAmount; + } + + /** + * Sets the value of the 'TaxableAmount' field. + * @param value The value of 'TaxableAmount'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setTaxableAmount(java.lang.Double value) { + validate(fields()[10], value); + this.TaxableAmount = value; + fieldSetFlags()[10] = true; + return this; + } + + /** + * Checks whether the 'TaxableAmount' field has been set. + * @return True if the 'TaxableAmount' field has been set, false otherwise. + */ + public boolean hasTaxableAmount() { + return fieldSetFlags()[10]; + } + + + /** + * Clears the value of the 'TaxableAmount' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearTaxableAmount() { + TaxableAmount = null; + fieldSetFlags()[10] = false; + return this; + } + + /** + * Gets the value of the 'CGST' field. + * @return The value. + */ + public java.lang.Double getCGST() { + return CGST; + } + + /** + * Sets the value of the 'CGST' field. + * @param value The value of 'CGST'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setCGST(java.lang.Double value) { + validate(fields()[11], value); + this.CGST = value; + fieldSetFlags()[11] = true; + return this; + } + + /** + * Checks whether the 'CGST' field has been set. + * @return True if the 'CGST' field has been set, false otherwise. + */ + public boolean hasCGST() { + return fieldSetFlags()[11]; + } + + + /** + * Clears the value of the 'CGST' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearCGST() { + CGST = null; + fieldSetFlags()[11] = false; + return this; + } + + /** + * Gets the value of the 'SGST' field. + * @return The value. + */ + public java.lang.Double getSGST() { + return SGST; + } + + /** + * Sets the value of the 'SGST' field. + * @param value The value of 'SGST'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setSGST(java.lang.Double value) { + validate(fields()[12], value); + this.SGST = value; + fieldSetFlags()[12] = true; + return this; + } + + /** + * Checks whether the 'SGST' field has been set. + * @return True if the 'SGST' field has been set, false otherwise. + */ + public boolean hasSGST() { + return fieldSetFlags()[12]; + } + + + /** + * Clears the value of the 'SGST' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearSGST() { + SGST = null; + fieldSetFlags()[12] = false; + return this; + } + + /** + * Gets the value of the 'CESS' field. + * @return The value. + */ + public java.lang.Double getCESS() { + return CESS; + } + + /** + * Sets the value of the 'CESS' field. + * @param value The value of 'CESS'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setCESS(java.lang.Double value) { + validate(fields()[13], value); + this.CESS = value; + fieldSetFlags()[13] = true; + return this; + } + + /** + * Checks whether the 'CESS' field has been set. + * @return True if the 'CESS' field has been set, false otherwise. + */ + public boolean hasCESS() { + return fieldSetFlags()[13]; + } + + + /** + * Clears the value of the 'CESS' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearCESS() { + CESS = null; + fieldSetFlags()[13] = false; + return this; + } + + /** + * Gets the value of the 'DeliveryType' field. + * @return The value. + */ + public java.lang.CharSequence getDeliveryType() { + return DeliveryType; + } + + /** + * Sets the value of the 'DeliveryType' field. + * @param value The value of 'DeliveryType'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setDeliveryType(java.lang.CharSequence value) { + validate(fields()[14], value); + this.DeliveryType = value; + fieldSetFlags()[14] = true; + return this; + } + + /** + * Checks whether the 'DeliveryType' field has been set. + * @return True if the 'DeliveryType' field has been set, false otherwise. + */ + public boolean hasDeliveryType() { + return fieldSetFlags()[14]; + } + + + /** + * Clears the value of the 'DeliveryType' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearDeliveryType() { + DeliveryType = null; + fieldSetFlags()[14] = false; + return this; + } + + /** + * Gets the value of the 'DeliveryAddress' field. + * @return The value. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress getDeliveryAddress() { + return DeliveryAddress; + } + + /** + * Sets the value of the 'DeliveryAddress' field. + * @param value The value of 'DeliveryAddress'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setDeliveryAddress(guru.learningjournal.kafka.examples.types.DeliveryAddress value) { + validate(fields()[15], value); + this.DeliveryAddressBuilder = null; + this.DeliveryAddress = value; + fieldSetFlags()[15] = true; + return this; + } + + /** + * Checks whether the 'DeliveryAddress' field has been set. + * @return True if the 'DeliveryAddress' field has been set, false otherwise. + */ + public boolean hasDeliveryAddress() { + return fieldSetFlags()[15]; + } + + /** + * Gets the Builder instance for the 'DeliveryAddress' field and creates one if it doesn't exist yet. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder getDeliveryAddressBuilder() { + if (DeliveryAddressBuilder == null) { + if (hasDeliveryAddress()) { + setDeliveryAddressBuilder(guru.learningjournal.kafka.examples.types.DeliveryAddress.newBuilder(DeliveryAddress)); + } else { + setDeliveryAddressBuilder(guru.learningjournal.kafka.examples.types.DeliveryAddress.newBuilder()); + } + } + return DeliveryAddressBuilder; + } + + /** + * Sets the Builder instance for the 'DeliveryAddress' field + * @param value The builder instance that must be set. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setDeliveryAddressBuilder(guru.learningjournal.kafka.examples.types.DeliveryAddress.Builder value) { + clearDeliveryAddress(); + DeliveryAddressBuilder = value; + return this; + } + + /** + * Checks whether the 'DeliveryAddress' field has an active Builder instance + * @return True if the 'DeliveryAddress' field has an active Builder instance + */ + public boolean hasDeliveryAddressBuilder() { + return DeliveryAddressBuilder != null; + } + + /** + * Clears the value of the 'DeliveryAddress' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearDeliveryAddress() { + DeliveryAddress = null; + DeliveryAddressBuilder = null; + fieldSetFlags()[15] = false; + return this; + } + + /** + * Gets the value of the 'InvoiceLineItems' field. + * @return The value. + */ + public java.util.List getInvoiceLineItems() { + return InvoiceLineItems; + } + + /** + * Sets the value of the 'InvoiceLineItems' field. + * @param value The value of 'InvoiceLineItems'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder setInvoiceLineItems(java.util.List value) { + validate(fields()[16], value); + this.InvoiceLineItems = value; + fieldSetFlags()[16] = true; + return this; + } + + /** + * Checks whether the 'InvoiceLineItems' field has been set. + * @return True if the 'InvoiceLineItems' field has been set, false otherwise. + */ + public boolean hasInvoiceLineItems() { + return fieldSetFlags()[16]; + } + + + /** + * Clears the value of the 'InvoiceLineItems' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosInvoice.Builder clearInvoiceLineItems() { + InvoiceLineItems = null; + fieldSetFlags()[16] = false; + return this; + } + + @Override + public PosInvoice build() { + try { + PosInvoice record = new PosInvoice(); + record.InvoiceNumber = fieldSetFlags()[0] ? this.InvoiceNumber : (java.lang.CharSequence) defaultValue(fields()[0]); + record.CreatedTime = fieldSetFlags()[1] ? this.CreatedTime : (java.lang.Long) defaultValue(fields()[1]); + record.StoreID = fieldSetFlags()[2] ? this.StoreID : (java.lang.CharSequence) defaultValue(fields()[2]); + record.PosID = fieldSetFlags()[3] ? this.PosID : (java.lang.CharSequence) defaultValue(fields()[3]); + record.CashierID = fieldSetFlags()[4] ? this.CashierID : (java.lang.CharSequence) defaultValue(fields()[4]); + record.CustomerType = fieldSetFlags()[5] ? this.CustomerType : (java.lang.CharSequence) defaultValue(fields()[5]); + record.CustomerCardNo = fieldSetFlags()[6] ? this.CustomerCardNo : (java.lang.CharSequence) defaultValue(fields()[6]); + record.TotalAmount = fieldSetFlags()[7] ? this.TotalAmount : (java.lang.Double) defaultValue(fields()[7]); + record.NumberOfItems = fieldSetFlags()[8] ? this.NumberOfItems : (java.lang.Integer) defaultValue(fields()[8]); + record.PaymentMethod = fieldSetFlags()[9] ? this.PaymentMethod : (java.lang.CharSequence) defaultValue(fields()[9]); + record.TaxableAmount = fieldSetFlags()[10] ? this.TaxableAmount : (java.lang.Double) defaultValue(fields()[10]); + record.CGST = fieldSetFlags()[11] ? this.CGST : (java.lang.Double) defaultValue(fields()[11]); + record.SGST = fieldSetFlags()[12] ? this.SGST : (java.lang.Double) defaultValue(fields()[12]); + record.CESS = fieldSetFlags()[13] ? this.CESS : (java.lang.Double) defaultValue(fields()[13]); + record.DeliveryType = fieldSetFlags()[14] ? this.DeliveryType : (java.lang.CharSequence) defaultValue(fields()[14]); + if (DeliveryAddressBuilder != null) { + record.DeliveryAddress = this.DeliveryAddressBuilder.build(); + } else { + record.DeliveryAddress = fieldSetFlags()[15] ? this.DeliveryAddress : (guru.learningjournal.kafka.examples.types.DeliveryAddress) defaultValue(fields()[15]); + } + record.InvoiceLineItems = fieldSetFlags()[16] ? this.InvoiceLineItems : (java.util.List) defaultValue(fields()[16]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + private static final org.apache.avro.io.DatumWriter + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + private static final org.apache.avro.io.DatumReader + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + +} diff --git a/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/PosLineItem.java b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/PosLineItem.java new file mode 100644 index 0000000..cbf0228 --- /dev/null +++ b/pos-fanout-avro/src/main/java/guru/learningjournal/kafka/examples/types/PosLineItem.java @@ -0,0 +1,477 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package guru.learningjournal.kafka.examples.types; + +import org.apache.avro.specific.SpecificData; + +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class PosLineItem extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = 1634587110905391044L; + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"PosLineItem\",\"namespace\":\"guru.learningjournal.kafka.examples.types\",\"fields\":[{\"name\":\"ItemCode\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemDescription\",\"type\":[\"null\",\"string\"]},{\"name\":\"ItemPrice\",\"type\":[\"null\",\"double\"]},{\"name\":\"ItemQty\",\"type\":[\"null\",\"int\"]},{\"name\":\"TotalValue\",\"type\":[\"null\",\"double\"]}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + @Deprecated public java.lang.CharSequence ItemCode; + @Deprecated public java.lang.CharSequence ItemDescription; + @Deprecated public java.lang.Double ItemPrice; + @Deprecated public java.lang.Integer ItemQty; + @Deprecated public java.lang.Double TotalValue; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use newBuilder(). + */ + public PosLineItem() {} + + /** + * All-args constructor. + * @param ItemCode The new value for ItemCode + * @param ItemDescription The new value for ItemDescription + * @param ItemPrice The new value for ItemPrice + * @param ItemQty The new value for ItemQty + * @param TotalValue The new value for TotalValue + */ + public PosLineItem(java.lang.CharSequence ItemCode, java.lang.CharSequence ItemDescription, java.lang.Double ItemPrice, java.lang.Integer ItemQty, java.lang.Double TotalValue) { + this.ItemCode = ItemCode; + this.ItemDescription = ItemDescription; + this.ItemPrice = ItemPrice; + this.ItemQty = ItemQty; + this.TotalValue = TotalValue; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return ItemCode; + case 1: return ItemDescription; + case 2: return ItemPrice; + case 3: return ItemQty; + case 4: return TotalValue; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: ItemCode = (java.lang.CharSequence)value$; break; + case 1: ItemDescription = (java.lang.CharSequence)value$; break; + case 2: ItemPrice = (java.lang.Double)value$; break; + case 3: ItemQty = (java.lang.Integer)value$; break; + case 4: TotalValue = (java.lang.Double)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'ItemCode' field. + * @return The value of the 'ItemCode' field. + */ + public java.lang.CharSequence getItemCode() { + return ItemCode; + } + + /** + * Sets the value of the 'ItemCode' field. + * @param value the value to set. + */ + public void setItemCode(java.lang.CharSequence value) { + this.ItemCode = value; + } + + /** + * Gets the value of the 'ItemDescription' field. + * @return The value of the 'ItemDescription' field. + */ + public java.lang.CharSequence getItemDescription() { + return ItemDescription; + } + + /** + * Sets the value of the 'ItemDescription' field. + * @param value the value to set. + */ + public void setItemDescription(java.lang.CharSequence value) { + this.ItemDescription = value; + } + + /** + * Gets the value of the 'ItemPrice' field. + * @return The value of the 'ItemPrice' field. + */ + public java.lang.Double getItemPrice() { + return ItemPrice; + } + + /** + * Sets the value of the 'ItemPrice' field. + * @param value the value to set. + */ + public void setItemPrice(java.lang.Double value) { + this.ItemPrice = value; + } + + /** + * Gets the value of the 'ItemQty' field. + * @return The value of the 'ItemQty' field. + */ + public java.lang.Integer getItemQty() { + return ItemQty; + } + + /** + * Sets the value of the 'ItemQty' field. + * @param value the value to set. + */ + public void setItemQty(java.lang.Integer value) { + this.ItemQty = value; + } + + /** + * Gets the value of the 'TotalValue' field. + * @return The value of the 'TotalValue' field. + */ + public java.lang.Double getTotalValue() { + return TotalValue; + } + + /** + * Sets the value of the 'TotalValue' field. + * @param value the value to set. + */ + public void setTotalValue(java.lang.Double value) { + this.TotalValue = value; + } + + /** + * Creates a new PosLineItem RecordBuilder. + * @return A new PosLineItem RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.PosLineItem.Builder newBuilder() { + return new guru.learningjournal.kafka.examples.types.PosLineItem.Builder(); + } + + /** + * Creates a new PosLineItem RecordBuilder by copying an existing Builder. + * @param other The existing builder to copy. + * @return A new PosLineItem RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.PosLineItem.Builder newBuilder(guru.learningjournal.kafka.examples.types.PosLineItem.Builder other) { + return new guru.learningjournal.kafka.examples.types.PosLineItem.Builder(other); + } + + /** + * Creates a new PosLineItem RecordBuilder by copying an existing PosLineItem instance. + * @param other The existing instance to copy. + * @return A new PosLineItem RecordBuilder + */ + public static guru.learningjournal.kafka.examples.types.PosLineItem.Builder newBuilder(guru.learningjournal.kafka.examples.types.PosLineItem other) { + return new guru.learningjournal.kafka.examples.types.PosLineItem.Builder(other); + } + + /** + * RecordBuilder for PosLineItem instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private java.lang.CharSequence ItemCode; + private java.lang.CharSequence ItemDescription; + private java.lang.Double ItemPrice; + private java.lang.Integer ItemQty; + private java.lang.Double TotalValue; + + /** Creates a new Builder */ + private Builder() { + super(SCHEMA$); + } + + /** + * Creates a Builder by copying an existing Builder. + * @param other The existing Builder to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.PosLineItem.Builder other) { + super(other); + if (isValidValue(fields()[0], other.ItemCode)) { + this.ItemCode = data().deepCopy(fields()[0].schema(), other.ItemCode); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.ItemDescription)) { + this.ItemDescription = data().deepCopy(fields()[1].schema(), other.ItemDescription); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.ItemPrice)) { + this.ItemPrice = data().deepCopy(fields()[2].schema(), other.ItemPrice); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.ItemQty)) { + this.ItemQty = data().deepCopy(fields()[3].schema(), other.ItemQty); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.TotalValue)) { + this.TotalValue = data().deepCopy(fields()[4].schema(), other.TotalValue); + fieldSetFlags()[4] = true; + } + } + + /** + * Creates a Builder by copying an existing PosLineItem instance + * @param other The existing instance to copy. + */ + private Builder(guru.learningjournal.kafka.examples.types.PosLineItem other) { + super(SCHEMA$); + if (isValidValue(fields()[0], other.ItemCode)) { + this.ItemCode = data().deepCopy(fields()[0].schema(), other.ItemCode); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.ItemDescription)) { + this.ItemDescription = data().deepCopy(fields()[1].schema(), other.ItemDescription); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.ItemPrice)) { + this.ItemPrice = data().deepCopy(fields()[2].schema(), other.ItemPrice); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.ItemQty)) { + this.ItemQty = data().deepCopy(fields()[3].schema(), other.ItemQty); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.TotalValue)) { + this.TotalValue = data().deepCopy(fields()[4].schema(), other.TotalValue); + fieldSetFlags()[4] = true; + } + } + + /** + * Gets the value of the 'ItemCode' field. + * @return The value. + */ + public java.lang.CharSequence getItemCode() { + return ItemCode; + } + + /** + * Sets the value of the 'ItemCode' field. + * @param value The value of 'ItemCode'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder setItemCode(java.lang.CharSequence value) { + validate(fields()[0], value); + this.ItemCode = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'ItemCode' field has been set. + * @return True if the 'ItemCode' field has been set, false otherwise. + */ + public boolean hasItemCode() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'ItemCode' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder clearItemCode() { + ItemCode = null; + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'ItemDescription' field. + * @return The value. + */ + public java.lang.CharSequence getItemDescription() { + return ItemDescription; + } + + /** + * Sets the value of the 'ItemDescription' field. + * @param value The value of 'ItemDescription'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder setItemDescription(java.lang.CharSequence value) { + validate(fields()[1], value); + this.ItemDescription = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'ItemDescription' field has been set. + * @return True if the 'ItemDescription' field has been set, false otherwise. + */ + public boolean hasItemDescription() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'ItemDescription' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder clearItemDescription() { + ItemDescription = null; + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'ItemPrice' field. + * @return The value. + */ + public java.lang.Double getItemPrice() { + return ItemPrice; + } + + /** + * Sets the value of the 'ItemPrice' field. + * @param value The value of 'ItemPrice'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder setItemPrice(java.lang.Double value) { + validate(fields()[2], value); + this.ItemPrice = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'ItemPrice' field has been set. + * @return True if the 'ItemPrice' field has been set, false otherwise. + */ + public boolean hasItemPrice() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'ItemPrice' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder clearItemPrice() { + ItemPrice = null; + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'ItemQty' field. + * @return The value. + */ + public java.lang.Integer getItemQty() { + return ItemQty; + } + + /** + * Sets the value of the 'ItemQty' field. + * @param value The value of 'ItemQty'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder setItemQty(java.lang.Integer value) { + validate(fields()[3], value); + this.ItemQty = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'ItemQty' field has been set. + * @return True if the 'ItemQty' field has been set, false otherwise. + */ + public boolean hasItemQty() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'ItemQty' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder clearItemQty() { + ItemQty = null; + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'TotalValue' field. + * @return The value. + */ + public java.lang.Double getTotalValue() { + return TotalValue; + } + + /** + * Sets the value of the 'TotalValue' field. + * @param value The value of 'TotalValue'. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder setTotalValue(java.lang.Double value) { + validate(fields()[4], value); + this.TotalValue = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'TotalValue' field has been set. + * @return True if the 'TotalValue' field has been set, false otherwise. + */ + public boolean hasTotalValue() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'TotalValue' field. + * @return This builder. + */ + public guru.learningjournal.kafka.examples.types.PosLineItem.Builder clearTotalValue() { + TotalValue = null; + fieldSetFlags()[4] = false; + return this; + } + + @Override + public PosLineItem build() { + try { + PosLineItem record = new PosLineItem(); + record.ItemCode = fieldSetFlags()[0] ? this.ItemCode : (java.lang.CharSequence) defaultValue(fields()[0]); + record.ItemDescription = fieldSetFlags()[1] ? this.ItemDescription : (java.lang.CharSequence) defaultValue(fields()[1]); + record.ItemPrice = fieldSetFlags()[2] ? this.ItemPrice : (java.lang.Double) defaultValue(fields()[2]); + record.ItemQty = fieldSetFlags()[3] ? this.ItemQty : (java.lang.Integer) defaultValue(fields()[3]); + record.TotalValue = fieldSetFlags()[4] ? this.TotalValue : (java.lang.Double) defaultValue(fields()[4]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + private static final org.apache.avro.io.DatumWriter + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, SpecificData.getEncoder(out)); + } + + private static final org.apache.avro.io.DatumReader + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, SpecificData.getDecoder(in)); + } + +} diff --git a/pos-fanout-avro/src/main/resources/log4j2.xml b/pos-fanout-avro/src/main/resources/log4j2.xml new file mode 100644 index 0000000..d9981a6 --- /dev/null +++ b/pos-fanout-avro/src/main/resources/log4j2.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pos-fanout-avro/src/main/resources/schema/HadoopRecord.avsc b/pos-fanout-avro/src/main/resources/schema/HadoopRecord.avsc new file mode 100644 index 0000000..f1c3485 --- /dev/null +++ b/pos-fanout-avro/src/main/resources/schema/HadoopRecord.avsc @@ -0,0 +1,21 @@ +{"namespace": "guru.learningjournal.kafka.examples.types", + "type": "record", + "name": "HadoopRecord", + "fields": [ + {"name": "InvoiceNumber", "type": ["null", "string"]}, + {"name": "CreatedTime", "type":["null", "long"]}, + {"name": "StoreID", "type": ["null", "string"]}, + {"name": "PosID", "type": ["null", "string"]}, + {"name": "CustomerType", "type": ["null", "string"]}, + {"name": "PaymentMethod", "type": ["null", "string"]}, + {"name": "DeliveryType", "type": ["null", "string"]}, + {"name": "City", "type": ["null", "string"]}, + {"name": "State", "type": ["null", "string"]}, + {"name": "PinCode", "type": ["null", "string"]}, + {"name": "ItemCode", "type": ["null", "string"]}, + {"name": "ItemDescription", "type": ["null", "string"]}, + {"name": "ItemPrice", "type": ["null", "double"]}, + {"name": "ItemQty", "type": ["null", "int"]}, + {"name": "TotalValue", "type": ["null", "double"]} + ] +} \ No newline at end of file diff --git a/pos-fanout-avro/src/main/resources/schema/Invoice.avsc b/pos-fanout-avro/src/main/resources/schema/Invoice.avsc new file mode 100644 index 0000000..6d67cb2 --- /dev/null +++ b/pos-fanout-avro/src/main/resources/schema/Invoice.avsc @@ -0,0 +1,52 @@ +{"namespace": "guru.learningjournal.kafka.examples.types", + "type": "record", + "name": "PosInvoice", + "fields": [ + {"name": "InvoiceNumber", "type": ["null", "string"]}, + {"name": "CreatedTime", "type":["null", "long"]}, + {"name": "StoreID", "type": ["null", "string"]}, + {"name": "PosID", "type": ["null", "string"]}, + {"name": "CashierID", "type": ["null", "string"]}, + {"name": "CustomerType", "type": ["null", "string"]}, + {"name": "CustomerCardNo", "type": ["null", "string"]}, + {"name": "TotalAmount", "type": ["null", "double"]}, + {"name": "NumberOfItems", "type": ["null", "int"]}, + {"name": "PaymentMethod", "type": ["null", "string"]}, + {"name": "TaxableAmount", "type": ["null", "double"]}, + {"name": "CGST", "type": ["null", "double"]}, + {"name": "SGST", "type": ["null", "double"]}, + {"name": "CESS", "type": ["null", "double"]}, + {"name": "DeliveryType", "type": ["null", "string"]}, + {"name": "DeliveryAddress", + "type": ["null", + {"type": "record", + "name": "DeliveryAddress", + "fields":[ + {"name": "AddressLine", "type": ["null", "string"]}, + {"name": "City", "type": ["null", "string"]}, + {"name": "State", "type": ["null", "string"]}, + {"name": "PinCode", "type": ["null", "string"]}, + {"name": "ContactNumber", "type": ["null", "string"]} + ] + } + ] + }, + {"name": "InvoiceLineItems", + "type" :["null", + {"type": "array", + "items" : { + "type": "record", + "name": "PosLineItem", + "fields": [ + {"name": "ItemCode", "type": ["null", "string"]}, + {"name": "ItemDescription", "type": ["null", "string"]}, + {"name": "ItemPrice", "type": ["null", "double"]}, + {"name": "ItemQty", "type": ["null", "int"]}, + {"name": "TotalValue", "type": ["null", "double"]} + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/pos-fanout-avro/src/main/resources/schema/Notification.avsc b/pos-fanout-avro/src/main/resources/schema/Notification.avsc new file mode 100644 index 0000000..de910fc --- /dev/null +++ b/pos-fanout-avro/src/main/resources/schema/Notification.avsc @@ -0,0 +1,10 @@ +{"namespace": "guru.learningjournal.kafka.examples.types", + "type": "record", + "name": "Notification", + "fields": [ + {"name": "InvoiceNumber", "type": ["null", "string"]}, + {"name": "CustomerCardNo", "type":["null", "string"]}, + {"name": "TotalAmount", "type": ["null", "double"]}, + {"name": "EarnedLoyaltyPoints", "type": ["null", "double"]} + ] +} \ No newline at end of file