Coder Social home page Coder Social logo

Comments (4)

fatmind avatar fatmind commented on July 4, 2024

meta在客户端事务类似,设置conn.setAutoCommit(false),及设置自动ack()为false
作用:不会将时间offest更新到zk,则下次启动后消费起点位置,仍和之前相同

在 2013年1月26日下午6:00,wangwei [email protected]写道:

看到介绍说,meta支持事务
动手配置的时候也看到system.ini部分有事务参数的配置

实际编写java的producer部分,看到有事务支持的api

consumer部分没有相关事务支持或者ack相关的api,是否consumer层面不支持事务或者ack相关的特性?

btwl:consumer消费单条message,有没有超时的概念?


Reply to this email directly or view it on GitHubhttps://github.com//issues/29.

from metamorphosis.

fatmind avatar fatmind commented on July 4, 2024

因为meta是主动拉取消息,超时只会发生在 ‘去服务端拉取消息时’,当获取消息后的处理,没有超时的概念

from metamorphosis.

killme2008 avatar killme2008 commented on July 4, 2024

虽然没有超时的概念,但是有一个参数可以设置最大重试次数:

ConsumerConfig#setMaxFetchRetries

可以设置一条消息最多重试的次数,超过这个次数将跳过,并将消息存储到消费者所在的本地文件系统并自动重试。默认是5次。

Meta的消费者的事务,只针对一个分区有效,通过message.getPartition()获取partition对象,然后利用Partition的下列三个方法来控制事务:

 /**
 * 设置是否自动ack
 * 
 * @param autoAck
 *            true表示自动ack
 */
public void setAutoAck(final boolean autoAck);
  /**
 * 应答本分区自上次应答以来收到的消息,meta客户端将递增offset,仅在设置autoAck为false的时候有效
 */
public void ack();
 /**
 * 回滚自上次应答以来收到的消息,meta将重试投递这些消息,仅在设置autoAck为false的时候有效
 */
public void rollback();

from metamorphosis.

killme2008 avatar killme2008 commented on July 4, 2024

事务的例子,在metamorphosis-example工程里有:

https://github.com/killme2008/metamorphosis-example

from metamorphosis.

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.