GithubHelp home page GithubHelp logo

Comments (8)

Geal avatar Geal commented on August 16, 2024

there might be a simple way to do that: remove serialization and deserialization from the producer and consumer API, and instead provide a nice API around the messages. Instead of having send, send_json, send_raw, let's just have send_message, but provide code examples for serialization.
On the consumer side, let's have a Stream of messages that will be parsed directly by the client code.

It will make simplify integration with other formats like Avro or Protobuf, and using the schema registry. It will also make message batching much easier to implement.
what do you think?

from pulsar-rs.

stearnsc avatar stearnsc commented on August 16, 2024

We have the SerializeMessage and DeserializeMessage traits; how would you feel about having send_message be generic over T: SerializeMessage or similar? (and same for the Stream impl on the consumer). Or are there things that just working with &[u8] and Vec<u8> buys us from an implementation perspective that I'm missing?

from pulsar-rs.

stearnsc avatar stearnsc commented on August 16, 2024

I went through and pulled the serde dependencies in favor of the above traits, and also made some other minor restructures (send_raw taking a Message instead of bytes, etc). It's on #45 if you want to take a look before I merge it in (and obviously I haven't published it yet, so time to change stuff if you foresee issues).

from pulsar-rs.

Geal avatar Geal commented on August 16, 2024

I'll look at it later today, thanks

from pulsar-rs.

Geal avatar Geal commented on August 16, 2024

from what I see, it can be useful to have some state management in the serialize/deserialize part (counting, message indexes, chunking, etc). Which is hard with the traits as they are. And if we need to get a schema dynamically (which is a thing apache people like to do) depending on the message, it will be hard to do from inside the trait.

from pulsar-rs.

stearnsc avatar stearnsc commented on August 16, 2024

As I see it, there's nothing stopping users from making the DeserializeMessage a pass-through and handling deserialization manually while consuming the Stream (allowing then to do whatever they want) - do you think that's a bad API for e.g. the apache use case? If not, I should add a DeserializeMessage impl for consumer::Message so users wouldn't need to newtype.

from pulsar-rs.

Geal avatar Geal commented on August 16, 2024

that should be fine for now, you're right

from pulsar-rs.

Geal avatar Geal commented on August 16, 2024

cf #92

from pulsar-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.