2nd message not posted to Discourse 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.