In my test above, both messages were sent successfully (there wasn’t any exception). The problem is after login Discourse account I saw only the 1st message was received but the 2nd message was missing.
Later, I found that if I put a delay of 20 seconds in between them (i.e. in the comment), then only both can be received by the server.
You might be hitting a rate limit. If that is the cause, Discourse should be returning a 429 response. There might be some information in your Discourse error logs about this. They are found at Admin / Logs / Error Logs.
If you are not seeing any errors there, try logging the response that Discourse sends to the server that’s running your Java code. That might give some useful information.
Depending on which account you’re using to post the messages you may be hitting ‘rate limit create topic’ or ’ rate limit create post’.
I’m just working on a script that sends 11 posts consecutively (within about a second) and that’s working OK, but they are being sent by the system account which might not have rate limits applied to it.
Thanks for the reply.
Yes, I got response from Discourse as below:
“You’re creating topics a bit too quickly. Please wait 15 seconds before trying again.”
I solved the problem by changing the rate limit in Admin page, set the post and topic creation to 0.
Now my question is possible to set the rate limit for specific account only?
No, the rate limit cannot be set for a specific account. The rate limit create topic and rate limit create post settings are not applied to staff accounts though. Possibly that could help for your use case.