Giter VIP home page Giter VIP logo

Comments (6)

edenhill avatar edenhill commented on May 8, 2024

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.

xiaojun789 avatar xiaojun789 commented on May 8, 2024

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.

edenhill avatar edenhill commented on May 8, 2024

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.

xiaojun789 avatar xiaojun789 commented on May 8, 2024

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.

edenhill avatar edenhill commented on May 8, 2024

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.

edenhill avatar edenhill commented on May 8, 2024

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)

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.