Comments (6)
Can you tell me about your use case for this?
Do you want to send one or multiple messages in each blocking synchronic produce_sync() call?
from librdkafka.
Hi,
we want to do the fail-tolerant operation, when the kafka cluster is not available. Currently there is message deliver callback. but some case the fail-tolerant will process twice. so we ask for sync interface.
I think you can give choice for log count sending per call.
Thanks~!
from librdkafka.
What do you mean by "fail-toerant will process twice"?
Do you mean the message send retry that librdkafka performs if the broker connection goes down?
The retry count is configurable through message.send.max.retries which defaults to 2.
from librdkafka.
fail-tolerant is implement in our program. if send the log to kafka failed, we should process it in our environment. and when the kafka is recover, we will send failed log to kafka again.
if we use async interface it is not good for this. we must wait the deliver callback method is callback, and do such fail-tolerant things. yesterday , I already find a way to avoid duplicated process failed logs message. use the last parameter of rd_kafka_produce().
but I think sync interface is easy for user to deal with this situation.
Thanks~!
from librdkafka.
I understand.
The drawbacks of a sync interface is that only a small number of messages may be produced at a given time and the application must queue messages for producing. The throughput is also minimal, at best, and is adversely affected by the application <-> broker latency.
Having said that I will look in to making a sync producer interface.
The current async produce interface provides full message tracking and reliability.
For each message produced the application may provide a pointer (that typically points to some application per-message object) called msg_opaque.
This msg_opaque value is provided to the application in the delivery report (dr) callback, along with an error code (to indicate success or specific failures), thus allowing the application to take actions if delivery of a message fails.
Read this for more information:
https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md#producer-api
The async produce interface also offers high performance and is not particularily affected by a high latency between application and broker.
from librdkafka.
See this wiki page for how to implement a sync producer in your application:
https://github.com/edenhill/librdkafka/wiki/Sync-producer
from librdkafka.
Related Issues (20)
- Error propagation differences between the callback and event API HOT 2
- Thread 15 "rdk:broker-1" received signal SIGSEGV, Segmentation fault. #1054
- ASAN Stack buffer overflow on broker hostname HOT 2
- delivery.timeout.ms seems not working for rd_kafka_produce and rd_kafka_conf_set_dr_msg_cb HOT 1
- "consistent_random" and "murmur2_random" partitioners treat empty keys differently HOT 3
- partition disconnects for ~60s after scaling down consumers HOT 1
- Deadlock in rd_kafka_offset_reset when concurrent with rd_kafka_destroy HOT 1
- How can I configure c# apache kafka Producer client with sasl.login.callback.handler.class?
- rd_kafka_consumer_close/rd_kafka_destroy remain blocked indefinitely if the broker is unreachable HOT 2
- Covscan defect finding: LOCK_EVASION
- Data race in `rd_kafka_stats_emit_all` HOT 6
- Problems with vcruntime140.dll HOT 1
- Hang if incremental assign is received while consumer is closing HOT 2
- Newly added partitions are not assigned to any consumer HOT 5
- commitAsync race condition HOT 4
- Offset cannot be set for KafkaConsumer HOT 2
- Error handling question "treat any error that has neither retriable, abortable, or fatal set, as a fatal error" HOT 1
- rd_kafka_commit_transaction failed, but messages were delivered to topics HOT 1
- I am unable to get producer. HOT 2
- Unable to check for updates HOT 6
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 librdkafka.