Ejemplo n.º 1
0
  /** 返回值表示是否发生变更 */
  public boolean updateChannel(
      final ClientChannelInfo clientChannelInfo,
      ConsumeType consumeType,
      MessageModel messageModel,
      ConsumeFromWhere consumeFromWhere) {
    boolean updated = false;
    this.consumeType = consumeType;
    this.messageModel = messageModel;
    this.consumeFromWhere = consumeFromWhere;

    ClientChannelInfo info = this.channelInfoTable.get(clientChannelInfo.getChannel());
    if (null == info) {
      ClientChannelInfo prev =
          this.channelInfoTable.put(clientChannelInfo.getChannel(), clientChannelInfo);
      if (null == prev) {
        log.info(
            "new consumer connected, group: {} {} {} channel: {}",
            this.groupName,
            consumeType,
            messageModel,
            clientChannelInfo.toString());
        updated = true;
      }

      info = clientChannelInfo;
    }

    this.lastUpdateTimestamp = System.currentTimeMillis();
    info.setLastUpdateTimestamp(this.lastUpdateTimestamp);

    return updated;
  }
Ejemplo n.º 2
0
 public void unregisterChannel(final ClientChannelInfo clientChannelInfo) {
   ClientChannelInfo old = this.channelInfoTable.remove(clientChannelInfo.getChannel().hashCode());
   if (old != null) {
     log.info(
         "unregister a consumer[{}] from consumerGroupInfo {}", this.groupName, old.toString());
   }
 }
Ejemplo n.º 3
0
 public void doChannelCloseEvent(final String remoteAddr, final Channel channel) {
   final ClientChannelInfo info = this.channelInfoTable.remove(channel);
   if (info != null) {
     log.warn(
         "NETTY EVENT: remove not active channel[{}] from ConsumerGroupInfo groupChannelTable, consumer group: {}",
         info.toString(),
         groupName);
   }
 }