Giter VIP home page Giter VIP logo

Comments (2)

boylede avatar boylede commented on June 12, 2024

Hi,

This looked like something I could take a stab at. I added the formats' crates and and modified the MessageBuilder impl to add a fn to set the desired serialization method, as well as updated Message::Body to match on the content-type of the message properties.

I wasn't sure if I should open a pull request or get some feedback here first. Let me know what you think.

boylede@a949c54

Couple things:

  • I wasn't sure what tests to add, any input here?

  • I added feature flags for each format, but this might not be desired

  • I added an additional enum to the error types to encapsulate all the different format errors. Unfortunately the rust messagepack crate uses three separate error types, so there are more entries for that one than otherwise needed.

  • I duplicated a chunk of code from Message::body() for each type; I'd prefer to find a more succinct way to format this but the desired functions from each format aren't organized into a trait by serde so I can't use a generic function for it without adding a bunch of boilerplate. A macro would work but that would probably be pretty opaque.

from rusty-celery.

epwalsh avatar epwalsh commented on June 12, 2024

Hey @boylede, this looks really great! Thanks for taking this.

Please definitely open a PR with what you have. A couple thoughts so far:

  • I think we should have tests that serialize and deserialize messages in various formats, checking that the original message is exactly the same as the deserialized one.
  • I like the idea of putting these behind feature flags, but having one feature flag for each different format seems a little overkill. Maybe we could put all of the non-default formats (so everything except json) behind a single feature flag.

from rusty-celery.

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.