test_class.declarator: topicName = "com.weevent.test"
test_class.modifier: private
test_class.original_string: private String topicName = "com.weevent.test";
test_class.type: String
test_class.var_name: topicName
test_class.declarator: channelName = "mychannel"
test_class.modifier: private
test_class.original_string: private String channelName = "mychannel";
test_class.type: String
test_class.var_name: channelName
test_class.declarator: topic2 = topicName + "1"
test_class.modifier: private final
test_class.original_string: private final String topic2 = topicName + "1";
test_class.type: String
test_class.var_name: topic2
test_class.declarator: topic3 = topicName + "2"
test_class.modifier: private final
test_class.original_string: private final String topic3 = topicName + "2";
test_class.type: String
test_class.var_name: topic3
test_class.declarator: wait3s = 3000
test_class.modifier: private final
test_class.original_string: private final long wait3s = 3000;
test_class.type: long
test_class.var_name: wait3s
test_class.declarator: transactionTimeout = 30000
test_class.modifier: private
test_class.original_string: private long transactionTimeout = 30000;
test_class.type: long
test_class.var_name: transactionTimeout
test_class.declarator: lastEventId = ""
test_class.modifier: private
test_class.original_string: private String lastEventId = "";
test_class.type: String
test_class.var_name: lastEventId
test_class.declarator: ext = new HashMap<>()
test_class.modifier: private
test_class.original_string: private Map<IConsumer.SubscribeExt, String> ext = new HashMap<>();
test_class.type: Map<IConsumer.SubscribeExt, String>
test_class.var_name: ext
test_class.declarator: defaultListener = new MyConsumerListener()
test_class.modifier: private
test_class.original_string: private IConsumer.ConsumerListener defaultListener = new MyConsumerListener();
test_class.type: IConsumer.ConsumerListener
test_class.var_name: defaultListener
test_class.declarator: iProducer
test_class.modifier: private
test_class.original_string: private FabricBroker4Producer iProducer;
test_class.type: FabricBroker4Producer
test_class.var_name: iProducer
test_class.declarator: iConsumer
test_class.modifier: private
test_class.original_string: private FabricBroker4Consumer iConsumer;
test_class.type: FabricBroker4Consumer
test_class.var_name: iConsumer
test_class.file: weevent-core/src/test/java/com/webank/weevent/core/fabric/FabricBroker4ConsumerTest.java
test_class.identifier: FabricBroker4ConsumerTest
test_class.superclass: extends JUnitTestBase
test_case.body: @Test
      public void testSingleTopicSubscribeList01() throws Exception {
          String[] topics = {this.topicName};
          String result = this.iConsumer.subscribe(topics, this.channelName, WeEvent.OFFSET_LAST, this.ext, this.defaultListener);
          Assert.assertFalse(result.isEmpty());
      }
test_case.class_method_signature: FabricBroker4ConsumerTest.testSingleTopicSubscribeList01()
test_case.full_signature: @Test public void testSingleTopicSubscribeList01()
test_case.identifier: testSingleTopicSubscribeList01
test_case.invocations: subscribe assertFalse isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSingleTopicSubscribeList01()
focal_class.declarator: subscriptions = new ConcurrentHashMap<>()
focal_class.modifier: private
focal_class.original_string: private Map<String, Subscription> subscriptions = new ConcurrentHashMap<>();
focal_class.type: Map<String, Subscription>
focal_class.var_name: subscriptions
focal_class.declarator: mainEventLoops = new ConcurrentHashMap<>()
focal_class.modifier: private
focal_class.original_string: private Map<String, MainEventLoop> mainEventLoops = new ConcurrentHashMap<>();
focal_class.type: Map<String, MainEventLoop>
focal_class.var_name: mainEventLoops
focal_class.declarator: executor
focal_class.modifier: private
focal_class.original_string: private Executor executor;
focal_class.type: Executor
focal_class.var_name: executor
focal_class.declarator: consumerStarted = false
focal_class.modifier: private
focal_class.original_string: private boolean consumerStarted = false;
focal_class.type: boolean
focal_class.var_name: consumerStarted
focal_class.declarator: idleTime
focal_class.modifier: private
focal_class.original_string: private int idleTime;
focal_class.type: int
focal_class.var_name: idleTime
focal_class.file: weevent-core/src/main/java/com/webank/weevent/core/fabric/FabricBroker4Consumer.java
focal_class.identifier: FabricBroker4Consumer
focal_class.interfaces: implements IConsumer, IBlockChain
focal_class.class_method_signature: FabricBroker4Consumer.FabricBroker4Consumer(FabricDelegate fabricDelegate)
focal_class.full_signature: public  FabricBroker4Consumer(FabricDelegate fabricDelegate)
focal_class.identifier: FabricBroker4Consumer
focal_class.modifiers: public
focal_class.parameters: (FabricDelegate fabricDelegate)
focal_class.signature:  FabricBroker4Consumer(FabricDelegate fabricDelegate)
focal_class.class_method_signature: FabricBroker4Consumer.isEventId(String offset)
focal_class.full_signature: private static boolean isEventId(String offset)
focal_class.identifier: isEventId
focal_class.modifiers: private static
focal_class.parameters: (String offset)
focal_class.return: boolean
focal_class.signature: boolean isEventId(String offset)
focal_class.class_method_signature: FabricBroker4Consumer.subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.full_signature: @Override public String subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.identifier: subscribe
focal_class.modifiers: @Override public
focal_class.parameters: (String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.return: String
focal_class.signature: String subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.class_method_signature: FabricBroker4Consumer.subscribe(String[] topics, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.full_signature: @Override public String subscribe(String[] topics, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.identifier: subscribe
focal_class.modifiers: @Override public
focal_class.parameters: (String[] topics, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.return: String
focal_class.signature: String subscribe(String[] topics, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_class.class_method_signature: FabricBroker4Consumer.subscribeTopic(String topic, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.full_signature: private String subscribeTopic(String topic, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.identifier: subscribeTopic
focal_class.modifiers: private
focal_class.parameters: (String topic, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.return: String
focal_class.signature: String subscribeTopic(String topic, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.class_method_signature: FabricBroker4Consumer.subscribeTopic(String[] topics, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.full_signature: private String subscribeTopic(String[] topics, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.identifier: subscribeTopic
focal_class.modifiers: private
focal_class.parameters: (String[] topics, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.return: String
focal_class.signature: String subscribeTopic(String[] topics, String channelName, String offset, Map<SubscribeExt, String> ext,
                                    ConsumerListener listener)
focal_class.class_method_signature: FabricBroker4Consumer.unSubscribe(String subscriptionId)
focal_class.full_signature: @Override public boolean unSubscribe(String subscriptionId)
focal_class.identifier: unSubscribe
focal_class.modifiers: @Override public
focal_class.parameters: (String subscriptionId)
focal_class.return: boolean
focal_class.signature: boolean unSubscribe(String subscriptionId)
focal_class.class_method_signature: FabricBroker4Consumer.listSubscription(String channnelName)
focal_class.full_signature: @Override public Map<String, SubscriptionInfo> listSubscription(String channnelName)
focal_class.identifier: listSubscription
focal_class.modifiers: @Override public
focal_class.parameters: (String channnelName)
focal_class.return: Map<String, SubscriptionInfo>
focal_class.signature: Map<String, SubscriptionInfo> listSubscription(String channnelName)
focal_class.class_method_signature: FabricBroker4Consumer.isStarted()
focal_class.full_signature: @Override public boolean isStarted()
focal_class.identifier: isStarted
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isStarted()
focal_class.class_method_signature: FabricBroker4Consumer.startConsumer()
focal_class.full_signature: @Override public synchronized boolean startConsumer()
focal_class.identifier: startConsumer
focal_class.modifiers: @Override public synchronized
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean startConsumer()
focal_class.class_method_signature: FabricBroker4Consumer.shutdownConsumer()
focal_class.full_signature: @Override public synchronized boolean shutdownConsumer()
focal_class.identifier: shutdownConsumer
focal_class.modifiers: @Override public synchronized
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean shutdownConsumer()
focal_class.class_method_signature: FabricBroker4Consumer.getIdleTime()
focal_class.full_signature: @Override public int getIdleTime()
focal_class.identifier: getIdleTime
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getIdleTime()
focal_class.class_method_signature: FabricBroker4Consumer.getBlockHeight(String channelName)
focal_class.full_signature: @Override public Long getBlockHeight(String channelName)
focal_class.identifier: getBlockHeight
focal_class.modifiers: @Override public
focal_class.parameters: (String channelName)
focal_class.return: Long
focal_class.signature: Long getBlockHeight(String channelName)
focal_class.class_method_signature: FabricBroker4Consumer.hasBlockEventNotify()
focal_class.full_signature: @Override public boolean hasBlockEventNotify()
focal_class.identifier: hasBlockEventNotify
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean hasBlockEventNotify()
focal_class.class_method_signature: FabricBroker4Consumer.loop(Long blockNum, String channelName)
focal_class.full_signature: @Override public List<WeEvent> loop(Long blockNum, String channelName)
focal_class.identifier: loop
focal_class.modifiers: @Override public
focal_class.parameters: (Long blockNum, String channelName)
focal_class.return: List<WeEvent>
focal_class.signature: List<WeEvent> loop(Long blockNum, String channelName)
focal_class.superclass: extends FabricTopicAdmin
focal_method.body: @Override
      public String subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener) throws BrokerException {
          this.validateChannelName(channelName);
          ParamCheckUtils.validateOffset(offset);
  
          Long currentBlock = fabricDelegate.getBlockHeight(channelName);
          // topic pattern
          if (Subscription.isTopicPattern(topic)) {
              Subscription.validateTopicPattern(topic);
              if (StringUtils.isNumeric(offset)) {
                  ParamCheckUtils.validateBlockHeight(offset, currentBlock);
              } else if (isEventId(offset)) {
                  // not a topic name
                  ParamCheckUtils.validateEventId("", offset, currentBlock);
              }
          } else {    // topic name
              ParamCheckUtils.validateTopicName(topic);
  
              // check topic exist
              if (!this.exist(topic, channelName)) {
                  throw new BrokerException(ErrorCode.TOPIC_NOT_EXIST);
              }
  
              if (StringUtils.isNumeric(offset)) {
                  ParamCheckUtils.validateBlockHeight(offset, currentBlock);
              } else if (isEventId(offset)) {
                  ParamCheckUtils.validateEventId(topic, offset, currentBlock);
              }
          }
  
          log.info("subscribe channelName: {} topic: {} offset: {} ext: {}", channelName, topic, offset, ext);
          return subscribeTopic(topic, channelName, offset, ext, listener);
      }
focal_method.class_method_signature: FabricBroker4Consumer.subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_method.full_signature: @Override public String subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_method.identifier: subscribe
focal_method.invocations: validateChannelName validateOffset getBlockHeight isTopicPattern validateTopicPattern isNumeric validateBlockHeight isEventId validateEventId validateTopicName exist isNumeric validateBlockHeight isEventId validateEventId info subscribeTopic
focal_method.modifiers: @Override public
focal_method.parameters: (String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)
focal_method.return: String
focal_method.signature: String subscribe(String topic, String channelName, String offset,
                              @NonNull Map<SubscribeExt, String> ext,
                              @NonNull ConsumerListener listener)