pulsar4s icon indicating copy to clipboard operation
pulsar4s copied to clipboard

producer.send does not strip ""

Open Haaroon opened this issue 3 years ago • 3 comments

Example code

    val client = PulsarClient("pulsar://localhost:6650")
    val producer_topic = Topic("test")
    val producer = client.producer[String](ProducerConfig(producer_topic))
    producer.send("Hello,World,1")

When sending this as a String and receiving a Array[Byte] pulsar4s does not strip the "" within the producer.send function

Haaroon avatar Dec 13 '21 16:12 Haaroon

What do you mean by “does not strip the ""?” What's supposed to be inside the ""? :thinking:

judu avatar Dec 16 '21 09:12 judu

Hi Judu. When the producer sends this message, the consumer receives the string "Hello,World,1" which includes the " on each side. By using Pulsar Java (without pulsar4s) this doesnt happen and the consumer receives Hello,World,1 only

Haaroon avatar Dec 16 '21 12:12 Haaroon

Maybe that's when you're sending JSON? If you're serializing as a regular string I'd expect the string to be received exactly as sent.

Can you provide an example of the code you expect to be equivalent in the Java and pulsar4s APIs?

gmethvin avatar Dec 18 '21 11:12 gmethvin