ZSMQ (Zola Simple Message Queue) is a very simple message queue created in java.
'zola' is a korean slang. It means 'utterly', 'extremely', 'super', 'very'
ZSMQ can be used in a variety of situations (ex, Poc or study), except in the operating environment.
ZSMQ is the best choice if you don't consider performance.
- Simplest
- Easiest
- intuitive configuration
- you to focus on other than message queue
ZSMQ is fast and easy to use, so we aim to minimize the configuration.
Check example to see the detailed configuration; there is a simple example using zsmq.
You can quickly create a great message queue by following these steps!
- run messaging server and dashboard
- gradle dependency
- configure property
- Just U.S.E it!!
ZSMQ provides two components:
Both of the following components must be run
- Messaging Server
- Message Server Dashboard
The Messaging Server manages the MQ. The destination to publish and subscribe to a message is Messaging Server.
The dashboard provides a view of the server. Describe the message queue and crreate/delete the MQ.
docker run --rm -d -p 8290:3000 dhslrl321/zsmq:dashboard.1.0.1
docker run --rm -d -p 8291:8291 dhslrl321/zsmq:server.1.0.0
messaging server and dashboard's port must be 8290, 8291 ! If you need to change the port, please raise it to issue.
Two dependencies are required to use zsmq.
- zola-messaging-core
- zola-messaging-spring-sdk
When used with spring framework, You can manually add dependencies one by one.
However, We provide a spring-boot-starter
so that you can skip the complicated process and set it up easily.
It can be downloaded from the jitpack repository.
Add the following blocks to build.gradle
repositories {
// ... other maven repository
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.dhslrl321.zsmq:zola-messaging-spring-boot-starter:${version}'
}
You can manually set bin without using the spring boot starter.
Check the reference guide for more information
Finally, The url of the Zola Messaging Server must be specified in application.yml
zsmq:
url: http://localhost:8291
listening: false
zsmq.url
: The Messaging Server url that manages the MQ.zsmq.listening
: Decide whether to register the listening thread automatically or not.- The listener thread is used when consuming.
Now you are done with all settings
You have to use it as it is.
- If you want to publish a message, please use
ZolaQueueMessagingTemplate
. - If you want to consume a message, please use '@ZolaConsumer' and
@ZolaMessageListener
@RequiredArgsConstructor
public class MessageProducer {
private final ZolaQueueMessageTemplate template;
public void send() {
template.convertAndSend("MY-QUEUE", "foo");
}
}
The 'zsmq.listening' attribute must be true when consuming a message.
@Component
@ZolaConsumer
public class MyConsumer {
@ZolaMessageListener(queueName = "MY-QUEUE", deletionPolicy = DeletionPolicy.ALWAYS)
public void listen(String message) {
System.out.println("message = " + message);
}
}
Check example to see the detailed configuration; there is a simple example using zsmq.
One day, I tried to use a message queue simply for studying.
It was not relevant to the message queue.
But I spent most of my time setting up message queues(RabbitMQ, SQS) and building infrastructure.
It was a very tough time just to perform convertAndSend.
So I decided to create a server that has low performance but highly productive message queue.
This is the beginning of zsmq.