orderAdd.setSize(10);
/* ... */
appender.startExcerpt(orderAdd.maxSize() + 1);
appender.writeUnsignedByte(orderAddMessageType); // encoding which message type is being written
appender.write(orderAdd);
appender.finish();
Our readers poll, read and dispatch callbacks depending on message types as follows:
if(tailer.nextIndex()) {
int messageType = tailer.readUnsignedByte();
switch(messageType) {
case orderAddMessageType:
readEntry(orderAdd);
listener.onOrderAdd(orderAdd);
break;
/* ... */
}
}
/* ... */
private <T extends Byteable> void readEntry(T t) {
t.bytes(tailer, 1);
tailer.finish();
}
Like this we can write and consume a number of different message types on the same queue, but I could imagine that this handling also could lead to issues on multiple appenders?
Thanks
Jonathan
<groupId>net.openhft</groupId>
<artifactId>chronicle-queue</artifactId>
<version>4.5.13</version>
Hello,
If you are using IndexedChronicle you have to ensure the appender is used in a thread safe manner. Eg by using synchronized.
If you are using VanillaChronicle you can use this across threads or processes.
Regards, Peter.
--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicle+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.