I have jmeter's mail reader sampler working and it fetches the email from my gmail account. The issue is that it keeps fetching the email from the oldest to newest manner and I have about ~10k messsages in my email.
So when I specify get 5 messages, it keeps fetching the oldest five messages in my email. Is there a way I can make it fetch only the latest 5 messages for me without making it fetch all ~10k messages in the process?
One more question: what if I want it to only fetch a message that has a certain keyword like this below, regardless of whether its in the latest 100 or latest 5 messages, especially as I keep getting emails throughout the day:
key "generated_key" (there is text preceding it and after it)
Can you tell me how I could make that work. Thank you!
Related
In our design we have something of a paradox. We have a database of projects. Each project has a status. We have a REST api to change a project from “Ready” status to “Cleanup” status. Two things must happen.
update the status in the database
send out an email to the approvers
Currently RESTful api does 1, and if that is successful, do 2.
But sometimes the email fails to send. But since (1) is already committed, it is not possible to rollback.
I don't want to send the email prior to commit, because I want to make sure the commit is successful before sending the email.
I thought about undoing step 1, but that is very hard. The status change involves adding new records to the history table, so I need to delete them. And if another person make other changes concurrently, the undo might get messed up.
So what can I do? If (2) fails, should I return “200 OK” to the client?
Seems like the best option is to return “500 Server Error” with error message that says “The project status was changed. However, sending the email to the approvers failed. Please take appropriate action.”
Perhaps I should not try to do 1 + 2 in a single operation? But that just puts the burden on the client, which is worse!
Just some random thoughts:
You can have a notification sent status flag along with a datetime of submission. When an email is successful then it flips, if not then it stays. When changes are submitted then your code iterates through ALL unsent notifications and tries to send. No idea what backend db you are suing but I believe many have the functionality to send emails as well. You could have a scheduled Job (SQL Server Agent for MSSQL) that runs hourly and tries to send if the datetime of the submission is lapsed a certain amount or starts setting off alarms if it fails as well.
If ti is that insanely important then maybe you could integrate a third party service such as sendgrid to run as a backup sending mech. That of course would be more $$ though...
Traditionally I've always separated functions like this into a backend worker process that handles this kind of administrative tasking stuff across many different applications. Some notifications get sent out every morning. Some get sent out every 15 minutes. Some are weekly summaries. If I run into a crash and burn then I light up the event log and we are (lucky/unlucky) enough to have server monitoring tools that alert us on specified application events.
I have java server application. And I need to monitor a lot of gmail accounts to be able to send push notifications to mobile devices about new Inbox messages.
I need to know sender email and message subject to send push notification.
And I tried Gmail push notifications system (webhooks option)
If I understood everything correctly in order to get needed info for each new message for each user there is a following scenario:
Google sends me email and history id via https request.
I call history API and get new message ids for user
I request message info by message id
That means that I need 2 additional requests for each new message of each user. And it looks quite hard if server needs to handle several new messages each second. And I still don't see other way.
Is there any way to make it shorter? (e.g. to make google send me not only history id but needed new message details or at least make one additional request, but not two)
Thanks!
We tried using Push notifications but the volume of requests generated has meant that we poll on a timed basis instead. It is worth noting that you will get Push notifications for any change to the message such as a label change, a read status change etc. As you say there are many requests.
If you need the notifications real-time I don't see how you can avoid the process that you outline.
If you don't need it real-time then you can poll or at the least check for Push notifications per account on a timed basis and if some have been received retrieve any new messages in a batch rather than a single request.
I was facing the same problem. History API was not giving recent messageId. I solved this problem by hitting THREAD API where i set Q = last 5 min timestamp.
Webhook push notification is helping to notify a new mail has come. After i get all messages last 10 min with THREAD API.
I also have a same problem as mentioned here. But, I went ahead with the approach of randomizing my resource so as to maintain the session in multiple tabs/windows. Also, I get carbon message (LINK) in all tabs/windows.
My only concern is, I'm saving chat history using (store.js) in my browser. And if 5 tabs are opened, then message gets saved 5 times. Which is a repeat.
How can I determine to how many tabs/windows the message was sent?
Based on the count I want to apply my logic to save the message only once.
You can count the number of tabs from Javascript because, you are sandbox to your own tab for security reason.
However, what you can do is ensure your client have unique id on the message tag and you can check on write if your message has already been written in your store or not.
I'm trying to implement chat for my webapp with following features:
When user logs in he should see a number of unread messages (which is both offline messages and "unseen", I will explain "unseen" in next step).
When user is anywhere in the app but on chat window he should be notified that he has a new message. Message should be marked "unseen" and must be added to the count of unread messages.
The first point is quite easily achieved using XEP-0013: Flexible Offline Message Retrieval. So I can retrieve offline messages and when I'm sure user has seen them - I remove them from unread list. But the problem is: how do I achieve same thing for "unseen" messages?
In short what I need is: any message should be marked as offline, unless user sees it and it's removed from the list by explicit request.
Can I achieve that with XMPP and how do I do that?
Thanks in advance.
What you are trying to do is to basically store a counter of unseen stuff in your account. I think you do not need flexible offline retrieval as when you connect the messages would simply become unseen. You thus only have to deal with one case: Unseen.
I will reply from the perspective of ejabberd, that I know better as one of the developer: I would use private storage to store your current state of unseen count and conversation.
I'm working on an email client for iOS. Currently I'm using MailCore for IMAP/SMTP interactions. I'm currently working on getting message previews for the inbox view. The only way I can think to do this would be to actually fetch the whole message body (only body for speed) from the server, and then display only a portion of the message. But then I would have to download the whole message again (this time all headers, etc) when the user opens the message. This seems a bit inefficient to me, but I can't figure out another way to approach this. I've considered just downloading the entirety of each message to begin with, but that seems like an abuse of user's mobile data, and it would be slower to populate the inbox with previews. Any thoughts on how to approach message previews?
Also, for the purposes of this question, assume that the message sender name, date, subject and flags are already loaded on the device.
there exists a raw fetch command but am not sure if there exists any wrapper api on top it.
FETCH 2 (BODY[]<0.size>)
for example if you want to fetch first 100 bytes of mail then you can fire a command as
FETCH 2 (BODY[]<0.100>)