Ejemplo n.º 1
0
  private void bizLogDelivered(String ip, List<MessageMeta> metas, Tpg tpg) {
    for (MessageMeta meta : metas) {
      BizEvent event = new BizEvent("Message.Delivered");
      event.addData("msgId", meta.getOriginId());
      event.addData("topic", tpg.getTopic());
      event.addData("partition", tpg.getPartition());
      event.addData("consumerIp", ip);
      event.addData("groupId", tpg.getGroupId());

      m_bizLogger.log(event);
    }
  }
  private void bizLog(
      CommandProcessorContext ctx,
      Map<Integer, MessageBatchWithRawData> rawBatches,
      int partition) {
    String ip = NettyUtils.parseChannelRemoteAddr(ctx.getChannel(), false);
    for (Entry<Integer, MessageBatchWithRawData> entry : rawBatches.entrySet()) {
      MessageBatchWithRawData batch = entry.getValue();
      List<PartialDecodedMessage> msgs = batch.getMessages();
      for (PartialDecodedMessage msg : msgs) {
        BizEvent event = new BizEvent("Message.Received");
        event.addData("topic", batch.getTopic());
        event.addData("partition", partition);
        event.addData("priority", entry.getKey());
        event.addData("producerIp", ip);
        event.addData("bornTime", msg.getBornTime());
        event.addData("refKey", msg.getKey());

        m_bizLogger.log(event);
      }
    }
  }