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
Message Deduplication #27
Comments
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. :) Originally posted by @chlegou in #25 (comment) |
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 Originally posted by @chlegou in #25 (comment) |
it's great that you moved it to a new thread :) |
* Provide a way to enqueue unique messages #27 * Provide a way to add HTTP proxy for external api calls #34 * Provide a way to fetch messages based on the id and queue name * Provide api to delete any enqueued messages #33 * Enqueue a list of Objects #37 * Do not delete queues if mode is PRODUCER #24 * Add csp meta data #38
Version 2.1.0-RELEASE have addressed this. |
Thanks, i will test it out. |
Hi there, it's doing great, and running smoothly, but i think i'm not
running the latest version. The last time i worked on it, i remember i was
using a deprecated class, and when checking the docs, i have found that the
docs still having the same deprecated class.
Following the server/app history by consulting history log stacks. I have
found that Android is having many limitations and not responding to every
server messages, so i ended up duplicating the job threads, by making the
mobile app calling the server to fetch if there's any work to do....
I would like to talk with you by email, if it's accepted, please let me
know and email me back. Here's my email: ***@***.***
…On Fri, Apr 30, 2021, 12:39 Sonu Kumar ***@***.***> wrote:
Hi @chlegou <https://github.com/chlegou>
It's a long time, I hope you're doing well.. How's Rqueue doing in
production? I would love to get your feedback
<https://github.com/sonus21/rqueue/issues/new?assignees=sonus21&labels=rqueue-user&template=i-m-using-rqueue.md&title=Add+my+organisation+in+Rqueue+user+list>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGIP54YO4IZMQJXPSC5ELHLTLKJG5ANCNFSM4O55TKIQ>
.
|
is there a way to see if a message object with
id: 124
(having the property id) is queued already or not? ideally, a queued message should have a unique tag that helps filtering queued messages for uniqueness and return a message status (... i'm inspired by Android Work Manager ). ...If this isn't implemented already in RQueue, i'm thinking of supporting it in my internal source code. (by checking the status of objects in@RqueueListener
) and reschedule it from the listener if needed to wait for more before executing it. what do you think?Originally posted by @chlegou in #25 (comment)
The text was updated successfully, but these errors were encountered: