We need an ID for many purposes. Instead of simply always choosing a string, we decided to use flexible IDs. This ensures that messages are very small when streamed (-> small messages). The ID can consist of one of the following subtypes:

Type Bytes when streamed
Integer 1, 2, 3 or 4 Bytes
String variable, UTF-8
UUID 1 (empty) or 17 Bytes
invalid ID 1 Byte

Thus, we are flexible, with low overhead at the same time.

  • If the highest performance is required, numeric IDs are used.
  • If readability is the top priority, you take the string.
  • For uniqueness and unique APIs, the UUID is suitable.

An ID is created via the CIdFactory class:

// Integers are simply incremented
IId id1 = CIdFactory.create(EIdType.INT);

// A random UUID is used as a string
IId id2 = CIdFactory.create(EIdType.STRING);

// A random UUID
IId id3 = CIdFactory.create(EIdType.UUID);

// An invalid ID
IId id4 = CIdFactory.create(EIdType.EMPTY);

To create an ID with a specific type, use a different method:

IId id1 = CIdFactory.create(EIdType.INT, 15);
IId id2 = CIdFactory.create(EIdType.STRING, "SYSTEM");
IId id3 = CIdFactory.create(EIdType.UUID, "e87092d7-2f74-4d7b-9eef-8bdd7789b049");

The decision for a class can also be made by the framework when simply passing an object:

IId id1 = CIdFactory.create(15);
IId id2 = CIdFactory.create("SYSTEM");
IId id3 = CIdFactory.create("e87092d7-2f74-4d7b-9eef-8bdd7789b049");

The CIdFactory is also good for a whole set of I/O methods. So IId objects are read from streams and from strings and written back in.

Similarly, there are a number of methods for IId arrays:

  • Read from and write to streams
  • Read from and write to strings
  • Reading from and writing to string arrays
  • Reading from and writing to string lists
  • Create random arrays
  • Comparison methods

The ID may be extended by other types later. This is very easily possible by registering another IIdFactory with the CIdFactory:


Major representatives: the target ID, the namespace ID - Innovative Distributed System