Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleJobCoordinator.java
public interface JobCoordinator {
	...
 
	// Before
	// int getProcessorId();
 
	String getProcessorIdgetLocalProcessorId();
	...
}

New Interface

Code Block
languagejava
titleProcessorIdGenerator.java
/**
  * To be used by the JobCoordinator to generator ProcessorId
  * It can be configured by using a configuration - app.processor-id-generator.class
  */
public interface ProcessorIdGenerator {
	/**
	* Generates a String representation to identify the processor instance
	* This value can be representative of its current executing environment. It can also be custom-managed by the user.
	* **Note**: processorId has to be unique among the processors within a job
	* @return String , identifier for the processor
	*/
	String generateProcessorId();
}
 
// Default (after 0.13+)
public class UUIDGenerator implements ProcessorIdGenerator {
	String generateProcessorId() {
	    return UUID.randomUUID();
	}
}

...

Existing users of StreamProcessor API should also set the processor.id config to the value previously assigned in the constructor. In case of more than one StreamProcessor within the same JVM, it is still required to use unique processorId for each StreamProcessor. The custom ProcessorIdGenerator, then, should contain a static counter which is incremented for each call to generateProcessorId and the counter value can be appended to the identifier

processor.id - to be deprecated in Samza 0.14.

...