Tag-based asynchronous messaging framework

2960a8e Implemented stopManager function which also calls on the now implemented stopWatcher and stopGC functions.

6 months ago

a4e4c3a Initial commit

6 months ago


Tag-based asynchronous messaging framework


The entry point is via the Manager type, so first create an instance as follows (passing the endpoint Socket in as socket in this example):

Manager manager = new Manager(socket);

Now the event loop would have started, now we are ready to send out some tagged messages and blocking receive for them!

Let's send out two messages with tags 1 and 2:

manager.sendMessage(1, [1,2,3,4,5]);
manager.sendMessage(2, [6,7,8,9,0]);

Now we can start two seperate threads and wait on them both:

byte[] receivedData = manager.receiveMessage(1);
byte[] receivedData = manager.receiveMessage(2);



[4 bytes (size-2, little endian)][8 bytes - tag][(2-size) bytes - data]


Thansk to Gabby Smuts for the name suggestion 😉️