The ideology of SimQ is closest to RabbitMQ. The differences are in several points:

lack of exchange points
availability of groups
availability of channels in groups
the presence of consumers and producers in the channels

Schematically , the structure of SimQ can be shown as follows:

The names of groups, channels, consumers and producers can consist of a maximum of 32 characters, include uppercase and lowercase letters of the English alphabet, numbers from 0 to 9.
The following are examples of server management via the console. Almost all of this can be done through the API.

Groups

Adding a group

Groups can include an unlimited number of channels. You can add and delete groups only through the console. To add a group, start the server with the admin parameter, for exmample ./simq-sever admin

Go to the groups section if you are not in it − cd /groups

To add a group, run add groupName - where groupName is the name of your group.

If a group with the same name already exists, you will see an error. If there is no group with this name, you will be prompted to enter a password and confirm it. After confirming the password, you will see a message that the group will be created by the server. The fact is that for the sake of data integrity, only a working server can apply changes that were created by the user. As a rule, when the server is running, changes are made very quickly. To see the newly added group, go to the groups section and run ls groupName. If the changes were applied by the server, you will see your group.

Deleting a group

To delete a group, you also need to go to the groups section, then run rm groupName and confirm the deletion. If the group does not exist, you will see an error. Also, the received changes will be applied by the server a little later. To make sure that the group is deleted, run ls groupName in the groups section. If the changes were applied by the server, you will not see the name of the deleted group.

Changing the password of group

In order to change the password of the group, you need to log in to it. For example cd /groups/groupName Then run the passwd command, enter a new password and confirm it. If everything was successful, you will see a message that the changes will be applied by the server later.

Example

use SimQ\Group;

$group = new Group( 'localhost', 4012, 'groupName', 'password' );
$group->updatePassword( 'current password', 'new password' );

Channels

Channels are used to store messages in a queue. The queue itself is arranged according to the FIFO principle.

Channel names should be unique only within the group.

Adding a channel

Go to the desired group cd /groups/groupName and execute add channelName Next, you will need to enter the following parameters:

minMessageSize - minimum message length

maxMessageSize - maximum message length

maxMessagesInMemory - maximum number of messages in memory

maxMessagesOnDisk - maximum number of messages on disk

The minMessageSize parameter must not be greater than maxMessageSize and cannot be equal to zero.

maxMessagesInMemory - should be used if you want to get maximum performance from the queue. It should be set to zero if the messages are large (for example, images, video files, etc.)

maxMessagesOnDisk - should be used when the message size is large enough, but it leads to a decrease in performance.

You can also use these 2 parameters together, in which case maxMessagesOnDisk will act as a backup for messages that do not fit in memory. The total maximum number of messages in the channel cannot be more than 4 294 967 295. If everything was successful, you will see a message that the changes will be applied by the server.

Channel update

To change the channel settings, go to cd /groups/groupName/channelName, and enter info. You will see a list of settings, to change a specific setting, enter for example set minMessageSize 1. If everything was successful, you will see a message that the changes will be applied by the server.

Deleting a channel

To delete a channel, go to the group cd /groups/groupName, and run rm channelName. Confirm the deletion. If everything was successful, you will see a message that the changes will be applied by the server.

Getting a list of channels
Getting the channel limit
Adding a channel
Channel update
Removing a channel

use SimQ\Group;

$group = new Group( 'localhost', 4012, 'groupName', 'password' );
$channels = $group->getChannels();
$limits = $group->getChannelLimitMessages( 'channelName' );

Consumers

Consumers are used to receive messages from the channel.

The names of consumers should be unique only among the consumers of the channel.

Adding a consumer

Go to the desired channel in the consumers section cd /groups/groupName/channelName/consumers and execute add consumerLogin. Enter the password and confirm it. If everything was successful, you will see a message that the changes will be applied by the server.

Changing the password of consumer

Go to the consumer cd/groups/groupName/channelName/consumers/consumerLogin and execute passwd. Enter a new password and confirm it. If everything was successful, you will see a message that the changes will be applied by the server.

Deleting a consumer

Go to the desired channel in the consumers section cd /groups/groupName/channelName/consumers and execute rm consumerLogin. If everything was successful, you will see a message that the changes will be applied by the server.

Get consumers
Adding a consumer
Updating password
Removing a consumer
Updating your password

use SimQ\Group;

$group = new Group( 'localhost', 4012, 'groupName', 'password' );
$consumers = $group->getConsumers( 'channelName' );

Producers

Producers are used to add messages to the channel.

Producer names should be unique only among channel producers.

Adding a producer

Go to the desired channel in the producers section cd /groups/groupName/channelName/producers and execute add producerLogin. Enter the password and confirm it. If everything was successful, you will see a message that the changes will be applied by the server.

Changing the password of producer

Go to the producer cd /groups/groupName/channelName/producers/producerLogin and execute passwd. Enter a new password and confirm it. If everything was successful, you will see a message that the changes will be applied by the server.

Deleting a producer

Go to the desired channel in the producers section cd /groups/groupName/channelName/producers and execute rm producerLogin. If everything was successful, you will see a message that the changes will be applied by the server.

Get producers
Adding a producer
Updating password
Removing a producer
Updating your password

use SimQ\Group;

$group = new Group( 'localhost', 4012, 'groupName', 'password' );
$producers = $group->getProducers( 'channelName' );
2023 © i@trusow.ru