Current status: Early development
This is a simple implementation of JMS interface. Just for fun :-)
No need to run servers, no network communication.
Messages can be stored:
- In file system
- In memory
Default storage: File system
Queues are folders. Messages are files.
Default data folder: ./db
File format: JSON
Use edu.mq.simple.storage.fs.FileSystemStorage class:
final var connectionFactory = new SimpleMQConnectionFactory();
final var fileSystemStorage = new FileSystemStorage("./db");
final var connection = connectionFactory.createConnection(fileSystemStorage);
...
Text message:
{
"headers": [
{
"name": "h1",
"type": "string",
"value": "header 1"
}
],
"type": "text",
"body": "Message body"
}
Bytes message:
{
"headers": [
{
"name": "h2",
"type": "integer",
"value": 123
}
],
"type": "bytes",
"body": "AQID"
}
Map message:
{
"headers": [],
"type": "map",
"body": {
"m1": {
"type": "string",
"value": "qwerty"
},
"m2": {
"type": "integer",
"value": 123
}
}
}
Messages are objects in memory. Very fast but not persistent.
Use edu.mq.simple.storage.mem.MemoryStorage class:
final var connectionFactory = new SimpleMQConnectionFactory();
final var memoryStorage = new MemoryStorage();
final var connection = connectionFactory.createConnection(memoryStorage);
...
Mainly educational
But it can be used for testing purpose.
You can prepare messages as JSON in test resources and use SimpleMQ to consume these files as Messages from Queue.
- string
- text
- byte
- map
- Nope
- Nope