Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started



sguzzo avatar image
sguzzo asked Erick Ramirez edited

Apache Pulsar schema doesn't have method builder()

I am trying to replicate the example here, under struct/SchemaDefinition. I would like to define the schema for my messages into a class called Davis which is defined as follows:

package com.example.streaming;

import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;

public class Davis {
    Timestamp timestamp;
    float temperature;

I have imported the annotations from the Lombok project and I don't know if this is correct but Pulsar's documentation is a bit poor here. My producer class is something like this

import org.apache.pulsar.client.api.*;
import org.apache.pulsar.client.impl.schema.JSONSchema;

public class DavisProducer {

    public static void main(String[] args) throws IOException {
        PulsarGetPropertyValues properties = new PulsarGetPropertyValues();

        PulsarClient client = PulsarClient.builder()

        Producer<Davis> producer = client.newProducer(JSONSchema.of(Davis.class))

        // Send a message to the topic
                .temp_out((float) 18.5556)




The code won't compile because Davis doesn't have the method builder(). What am I missing?

astra streaming
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

sguzzo avatar image
sguzzo answered

The issue was that Lombok Project was not included as a compileOnly dependency in Gradle (v7.1).

Found the answer at

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.