获取来自kafka-node的最新消息

时间:2019-07-17 13:11:27

标签: node.js apache-kafka

我正在使用具有以下选项的kafka-node消费者组

<FlatList
  // ...
  onChangeText={text => {
    // this line creates a copy of tableData array
    const copyTableData = [...this.state.tableData];

    let newQte = '';
    let numbers = '0123456789';

    for (var i = 0; i < text.length; i++) {
      if (numbers.indexOf(text[i]) > -1) {
        newQte = newQte + text[i];
        console.log('new qte', newQte);
      } else {
        alert('Veuillez saisir uniquement des chiffres.');
      }
    }

    // we're creating a completely new item object...
    const newItem = {
      ...copyTableData[index],
      quantity: newQte,
    };

    // ... which replace the initial item in our copy
    copyTableData.splice(index, 1, newItem);

    // We're updating the state, with a fresh new array
    // This way React "see" there was a change and re-render the item
    this.setState({
      tableData: copyTableData,
    });
  }}
>

但是它仍然没有收到最新消息,我如何只从消费者那里获取最新消息?

0 个答案:

没有答案