第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 poll() 的消費者單元測試永遠不會收到任何東西

使用 poll() 的消費者單元測試永遠不會收到任何東西

三國紛爭 2021-10-20 14:40:08
考慮以下代碼:@Test(singleThreaded = true)public class KafkaConsumerTest{  private KafkaTemplate<String, byte[]> template;  private DefaultKafkaConsumerFactory<String, byte[]> consumerFactory;  private static final KafkaEmbedded EMBEDDED_KAFKA;  static {      EMBEDDED_KAFKA = new KafkaEmbedded(1, true, "topic");      try { EMBEDDED_KAFKA.before(); } catch (final Exception e) { e.printStackTrace(); }    }  @BeforeMethod  public void setUp() throws Exception {    final Map<String, Object> senderProps = KafkaTestUtils.senderProps(EMBEDDED_KAFKA.getBrokersAsString());    senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);    senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class);    final ProducerFactory<String, byte[]> pf = new DefaultKafkaProducerFactory<>(senderProps);    this.template = new KafkaTemplate<>(pf);    this.template.setDefaultTopic("topic");    final Map<String, Object> consumerProps = KafkaTestUtils.consumerProps("sender", "false", EMBEDDED_KAFKA);    this.consumerFactory = new DefaultKafkaConsumerFactory<>(consumerProps);    this.consumerFactory.setValueDeserializer(new ByteArrayDeserializer());    this.consumerFactory.setKeyDeserializer(new StringDeserializer());  }我正在嘗試向 a 發(fā)送消息KafkaTemplate并使用Consumer.poll(). 我使用的測試框架是TestNG。發(fā)送作品,我已經(jīng)驗證使用我在網(wǎng)上找到的“常用”代碼(在 上注冊一個消息偵聽器KafkaMessageListenerContainer)。只是,我從來沒有在消費者那里收到過任何東西。我已經(jīng)針對“真實”的 Kafka 安裝嘗試了相同的序列 (create Consumer, poll()),并且它有效。因此,我設(shè)置ConsumerFactory? 任何幫助將不勝感激!
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 189 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號