Problems receiving downlinks using the Java API

Thanks for the answers.

I’m using version 1.0.0 due to the circumstances described here.

I’m working from Germany and am using the EU application server but still have a delay of about 500 ms till the data is actually received and processed by the Java API on server side. This may be caused by the size of the data payload which is most of the time about 115 Byte.

This is one shortened part of the application which tends to make problems. I try to respond directly to an uplink message. Is this a problem?

client.onMessage(new BiConsumer<String, Object>() {
		@Override
		public void accept(String _devID, Object _data) {
			System.out.println("Message: " + _devID + " " + _data);
			try {
                JSONObject jobject = (JSONObject) _data;
	        	if (jobject.get("port").equals(49) && !sending) {

					int i, checkCtr;
					Object test = jobject.get("payload_raw");


                    //---------------------------------
                    //some computations with object test
                    //---------------------------------

					// application acks 
					if (i == checkCtr) {
						client.send(_devID, new String("DUPLICATE").getBytes(), 1);				
                        return;
					} else if (i != checkCtr - 1) {
						client.send(_devID, new String("ERROR").getBytes(), 1);
						Arrays.fill(fragData, (byte) 0);
						fragment = false;
						return;
					} else {	
			         	checkCtr = i;
						client.send(_devID,	new String("OK").getBytes(), 1);
             		}

				}  catch (Exception ex) {
				    System.out.println("Response failed: " + ex.getMessage());
			    }
		}
});

Do I need to let the responses get queued first and then send another uplink message which is just intended to receive the last queued downlink before I proceed with the actual application messages?