Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practice of initializing a queue (producer only) #225

Closed
stefan-g opened this issue Apr 16, 2024 · 1 comment
Closed

Best practice of initializing a queue (producer only) #225

stefan-g opened this issue Apr 16, 2024 · 1 comment
Labels
question Further information is requested

Comments

@stefan-g
Copy link

I have 2 different instances. One instance produces jobs and one consumes it. It does only work correct when i register the queue manually by the manager. Is that the way how it should be?

@log4j2
@service
public class RQueueMessageService {

private final RqueueMessageEnqueuer rqueueMessageEnqueuer;
private final RqueueEndpointManager manager;

public RQueueMessageService(final RqueueMessageEnqueuer rqueueMessageEnqueuer, final RqueueEndpointManager manager) {
this.rqueueMessageEnqueuer = rqueueMessageEnqueuer;
this.manager = manager;
this.manager.registerQueue("import-job");
}

public void createJOB(ImportMessage message) {
rqueueMessageEnqueuer.enqueueWithRetry("import-job", message,3);
}

}
@sonus21
Copy link
Owner

sonus21 commented May 7, 2024

Hi @stefan-g
Which version of Rqueue do you have?
In this doc, we've explained a different way to use it, https://sonus21.github.io/rqueue/producer-consumer

If you're using the same application code for producer and consumer in that case you don't have to call register queue method.

You can just rqueue.scheduler.enabled=false and rqueue.system.mode=PRODUCER in the producer application instance. In consumer you can let it be default behaviour.

A sample test app

@sonus21 sonus21 added enhancement New feature or request question Further information is requested and removed enhancement New feature or request labels May 7, 2024
@sonus21 sonus21 closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants