Comments (8)
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.
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.
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.
I'll look at it later today, thanks
from pulsar-rs.
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.
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.
that should be fine for now, you're right
from pulsar-rs.
cf #92
from pulsar-rs.
Related Issues (20)
- Why client redirect to ssl connection? HOT 1
- Consumer stucks in reconnections HOT 9
- Consumer `try_next` stops producing messages, but consumer is still processing messages internally
- Producer and Consumer IDs
- Limit producer batch messages by size in bytes as well HOT 2
- Connection error: bytes remaining on stream
- Timeout in batching
- Negative unackedMessages in consumers
- Unable to cleanly close a consumer without unsubscribing from a topic HOT 2
- Mutex in producer::TopicProducer is unnecessary
- Concretize types for client building
- TLS BAD_PACKET_LENGTH Error
- Authentication Errors swallowed and never surfaced to places where you could handle the error HOT 1
- 在使用正则订阅的时候提示没有权限
- Please add an option to skip invalid metadata instead of shutdown the consumer
- Missing `batchingMaxPublishDelay` option
- migrate `async_rustls` to `futures-rustls` HOT 1
- If the producer message generated by pulsar client is encapsulated as a function, only one message can be sent in a topic
- Reading the latest message?
- Channel closed issue during consumption since #312 HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pulsar-rs.