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
Unable to configure Rqueue in jhipster Spring boot microservice application #25
Comments
Hi Chlegou @EnableCaching(proxyTargetClass = true)
@SpringBootApplication
public class Main{
...
} Generally this should be able to fix the issue. Please share a sample app incase this could not fix your issue. |
As an Immediate fix, you can disable devtools restart using |
I have created the sample app: https://github.com/chlegou/jhipster-rqueue btw, i have also tested |
Thank you so much for providing simple app for debugging. I have released a fix, please use version 2.0.2-RELEASE, let me know if you are facing any other issue with Rqueue. |
version 2.0.2-RELEASE isn't available in maven, could you please add it? |
It will take time to reach there but it should be available to download can be verified at https://repo1.maven.org/maven2/com/github/sonus21/rqueue-spring-boot-starter. |
i was able to run test the project with the new release you have created. the app is working finally! :) talking now about performance, i have tested the app with the default it's obvious that many messages was skipped. following the stats from the dashboard you provided, none are discarded. Instead, it's showing that they got all executed. Testing again the app with the default Only one job was skipped out of 6. my question is about accuracy of the library, will every scheduled job will get successfully executed? i hope you could test the lib performance as accuracy is so much important. also, to follow the job, as they was showing they're executed in the dashboard, but they really wasn't executed Thank you again for the quick help you have provided. 🥇 |
You're running tasks using Async task executor, so the execution results might come later, since all are getting queued.
It's guaranteed that each job would be executed successfully, you can verify the same by removing Async annotation from listener methods, though you don't need Async annotation since one dedicated thread is used for the listener's method execution. To verify this you can add an atomic counter and assign an id to each job and write the job logs to a file. From logs we can see which jobs are skipped. |
ah i see, i have added the i will test again without it, and let you know. Thanks again for pointing it to me. |
i have removed the i have simplified the logs, and even if i schedule 2 jobs (with same message), usually only one get executed. |
I tried for 69 messages and all of them had successful execution. Here's the patch to verify https://pastebin.com/UZ2DzAQg |
ok, have you get all echo messages in console? because sometimes it wasn't written there. could you please provide the source code with the changes you have made? |
I didn't go through all the logs, but I have added code to verify if it's working or not. Please find the updated code at https://github.com/sonus21/jhipster-rqueue/tree/demo |
hi, as i'm working on the integration, the alpha tests are promising so far. the RQueue is working as expected so far. :) i have a question: (i know that this thread is for bug tracking, i'm ok to move my question to stackoverflow if wanted)
|
No, currently there's no way to identify this. As you said you can implement this easily by making a lookup in the listener.
I won't recommend you to schedule messages from listener as it can cause duplicate message queueing problem, now you need to work on idempotency. I would suggest you use pre execution message processor. Using pre execution processor, you skip the execution if you find there's a new message for the given id, it would be as simple as tracking the enqueue time corresponding to a message. |
Well, scheduling with a unique tag, would discard old messages having same tag. so we're always talking about a single message. In Android workmanager, there's 2 concepts: unique tags and normal tags. messages could have many identification tags, but unique messages are having a unique tag and unique message in the queue.
could you provide an example of it? i didn't understand how to implement it. i might go with the lookup in the listener, as it seems to be the most easy and logical as it's related to the app logic not to the rqueue library. and from the listener i chose what code i need to execute. Thanks for your time and help. they're really appreciated. :) |
This looks to be promising, what about the execution time? For example Message
interface MessageRepository {
Long getLatestEnqueueAt(String messageId);
}
class UniqueMessageProcessor implements MessageProcessor{
@Autowired MessageRepository messageRepository;
@Override
boolean process(Object message, RqueueMessage rqueueMessage){
if(message instanceof SimpleMessage){
// here you can get id using tags
String messageId = ((SimpleMessage)message).getId();
Long latestEnqueueTime= messageRepository.getLatestEnqueueAt(messageId) ;
if( latestEnqueueTime != null && latestEnqueueTime > rqueueMessage.getQueuedTime() ) {
return false;
}
}
return true;
}
}
class RqueueConfiguration{
@Bean
public MessageProcessor preExecutorMessageProcessor(){
return new UniqueMessageProcessor()
}
@Bean
public SimpleRqueueListenerContainerFactory simpleRqueueListenerContainerFactory(){
SimpleRqueueListenerContainerFactory factory = new SimpleRqueueListenerContainerFactory();
MessageProcessor preExecutorMessageProcessor = preExecutorMessageProcessor();
factory.setPreExecutionMessageProcessor(preExecutorMessageProcessor);
return factory;
}
} I'll add this in the wiki in a new section "Message deduplication section". |
Well in our case, i believe that the most logical use case is Cancel the existing chain and REPLACE it with the new one. With this being said, let's say we have a mechanism that allow as to fetch a message details with a specific unique tag:
Following the Android Work Manager Unique Work policies, it support 3 conflict resolution policies:
Since RQueue is a server implementation which should handle/have access to data directly, i believe that the most logical use case is by replacing old messages by the new one. since enqueueing same job messages comes after fresh data check which is not the same case with Android Work Manager. (... let's see if other users might address different use cases in the future that requires old queued unique jobs mandatory execution...) As i also recommend adding the feature of fetching queued messages info by these 2 methods: for the |
I have created another ticket for this, let's track this over there. I'm happy to accept a PR. |
Describe the bug
I'm not able to configure Rqueue in a jHipster Spring boot microservice application. I have followed all your resources over the internet and also your tutorial projects, but without luck
this is my pom file:
Here is my configuration file:
How to Reproduce
generate a jHipster microservice project and integrate Rqueue in it.
here is the error i'm getting:
additional resources
use https://start.jhipster.tech/ to generate a jHipster app in just 1min. here is my configurations: https://i.ibb.co/rZ7mrsS/image.png
please help me with this.
The text was updated successfully, but these errors were encountered: