private static void doCommonChecks(FunctionConfig functionConfig) { Collection<String> allInputTopics = collectAllInputTopics(functionConfig); if (allInputTopics.isEmpty()) { throw new RuntimeException("No input topic(s) specified for the function"); } // Ensure that topics aren't being used as both input and output verifyNoTopicClash(allInputTopics, functionConfig.getOutput()); WindowConfig windowConfig = functionConfig.getWindowConfig(); if (windowConfig != null) { // set auto ack to false since windowing framework is responsible // for acking and not the function framework if (functionConfig.isAutoAck() == true) { throw new IllegalArgumentException("Cannot enable auto ack when using windowing functionality"); } functionConfig.setAutoAck(false); } if (functionConfig.getTimeoutMs() != null && functionConfig.getProcessingGuarantees() != null && functionConfig.getProcessingGuarantees() != FunctionConfig.ProcessingGuarantees.ATLEAST_ONCE) { throw new IllegalArgumentException("Message timeout can only be specified with processing guarantee is " + FunctionConfig.ProcessingGuarantees.ATLEAST_ONCE.name()); } if (functionConfig.getMaxMessageRetries() >= 0 && functionConfig.getProcessingGuarantees() == FunctionConfig.ProcessingGuarantees.EFFECTIVELY_ONCE) { throw new IllegalArgumentException("MaxMessageRetries and Effectively once don't gel well"); } if (functionConfig.getMaxMessageRetries() < 0 && !StringUtils.isEmpty(functionConfig.getDeadLetterTopic())) { throw new IllegalArgumentException("Dead Letter Topic specified, however max retries is set to infinity"); } }
validateSerde(inputSerializer, typeArgs[0], name, clsLoader, true); }); validateSchema(schemaType, typeArgs[0], name, clsLoader, true); }); validateSerde(conf.getSerdeClassName(), typeArgs[0], name, clsLoader, true); validateSchema(conf.getSchemaType(), typeArgs[0], name, clsLoader, true); validateSchema(functionConfig.getOutputSchemaType(), typeArgs[1], name, clsLoader, false); validateSerde(functionConfig.getOutputSerdeClassName(), typeArgs[1], name, clsLoader, false);
@Override public void validateField(String name, Object o, ClassLoader classLoader) { FunctionConfig functionConfig = (FunctionConfig) o; doCommonChecks(functionConfig); if (functionConfig.getRuntime() == FunctionConfig.Runtime.JAVA) { if (classLoader != null) { doJavaChecks(functionConfig, name, classLoader); } } else { doPythonChecks(functionConfig, name); } } }