コード例 #1
0
  public void initSchema(StreamSchema ss) throws Exception {
    trace.log(TraceLevel.INFO, "Connection properties: " + finalProperties);

    Set<MetaType> supportedTypes = new HashSet<MetaType>();
    supportedTypes.add(MetaType.RSTRING);
    supportedTypes.add(MetaType.USTRING);
    supportedTypes.add(MetaType.BLOB);

    keyAH.initialize(ss, false, supportedTypes);
    messageAH.initialize(ss, true, supportedTypes);

    // blobs are not supported for topics
    supportedTypes.remove(MetaType.BLOB);
    topicAH.initialize(ss, false, supportedTypes);

    OperatorContext operContext = getOperatorContext();
    if (operContext.getParameterNames().contains("partition") == false) {
      // we don't need to create this client if using simpleConsumerClient
      trace.log(TraceLevel.INFO, "Creating client");
      client = new KafkaClient(topicAH, keyAH, messageAH, finalProperties);
    }
  }