Source:
<code>protected void setupSystem() { config = getConfig(); SystemFactory systemFactory = null; Log4jSystemConfig log4jSystemConfig = new Log4jSystemConfig(config); if (streamName == null) { streamName = getStreamName(log4jSystemConfig.getJobName(), log4jSystemConfig.getJobId()); } MetricsRegistry metricsRegistry = new MetricsRegistryMap(); metrics = new StreamAppenderMetrics("stream-appender", metricsRegistry); String systemName = log4jSystemConfig.getSystemName(); String systemFactoryName = log4jSystemConfig.getSystemFactory(systemName); if (systemFactoryName != null) { systemFactory = Util.<SystemFactory>getObj(systemFactoryName); } else { throw new SamzaException("Could not figure out \"" + systemName + "\" system factory for log4j StreamAppender to use"); } setSerde(log4jSystemConfig, systemName, streamName); JobConfig jobConfig = new JobConfig(config); <START> StreamSpec streamSpec = StreamSpec.createStreamAppenderSpec(streamName, systemName, jobConfig.getContainerCount()); <END> SystemAdmin systemAdmin = systemFactory.getAdmin(systemName, config); systemAdmin.createStream(streamSpec); systemProducer = systemFactory.getProducer(systemName, config, metricsRegistry); systemStream = new SystemStream(systemName, streamName); systemProducer.register(SOURCE); systemProducer.start(); log.info(SOURCE + " has been registered in " + systemName + ". So all the logs will be sent to " + streamName + " in " + systemName + ". Logs are partitioned by " + key); startTransferThread(); }</code><technical_language>behavior for standalone mode, a predefined container count? number of tasks in case? require a config. some reasonable default</technical_language>

Target:
protected void setupSystem() { config = getConfig(); SystemFactory systemFactory = null; Log4jSystemConfig log4jSystemConfig = new Log4jSystemConfig(config); if (streamName == null) { streamName = getStreamName(log4jSystemConfig.getJobName(), log4jSystemConfig.getJobId()); } MetricsRegistry metricsRegistry = new MetricsRegistryMap(); metrics = new StreamAppenderMetrics("stream-appender", metricsRegistry); String systemName = log4jSystemConfig.getSystemName(); String systemFactoryName = log4jSystemConfig.getSystemFactory(systemName); if (systemFactoryName != null) { systemFactory = Util.<SystemFactory>getObj(systemFactoryName); } else { throw new SamzaException("Could not figure out \"" + systemName + "\" system factory for log4j StreamAppender to use"); } setSerde(log4jSystemConfig, systemName, streamName); System.out.println("[StreamAppender] creating stream " + streamName + " with partition count " + getPartitionCount()); StreamSpec streamSpec = StreamSpec.createStreamAppenderStreamSpec(streamName, systemName, getPartitionCount()); SystemAdmin systemAdmin = systemFactory.getAdmin(systemName, config); systemAdmin.start(); systemAdmin.createStream(streamSpec); systemAdmin.stop(); systemProducer = systemFactory.getProducer(systemName, config, metricsRegistry); systemStream = new SystemStream(systemName, streamName); systemProducer.register(SOURCE); systemProducer.start(); log.info(SOURCE + " has been registered in " + systemName + ". So all the logs will be sent to " + streamName + " in " + systemName + ". Logs are partitioned by " + key); startTransferThread(); }