qy-liuhuo opened a new issue, #11175:
URL: https://github.com/apache/inlong/issues/11175

   ### What happened
   
   The current MqttSource solution may cause message loss
   
   ### What you expected to happen
   
   
   ```java
   @Override
   public void messageArrived(String topic, MqttMessage message) throws 
Exception {
       Map<String, String> headerMap = new HashMap<>();
       headerMap.put("record.topic", topic);
       headerMap.put("record.messageId", String.valueOf(message.getId()));
       headerMap.put("record.qos", String.valueOf(message.getQos()));
       byte[] recordValue = message.getPayload();
       mqttMessagesQueue.offer(new DefaultMessage(recordValue, headerMap), 1, 
TimeUnit.SECONDS);
   
   }
   ```
   
   
   
   Due to the timeout mechanism of blocking queue 
offers(`mqttMessagesQueue.offer(new DefaultMessage(recordValue, headerMap), 1, 
TimeUnit.SECONDS);`), messages may be lost when the queue is full
   
   ### How to reproduce
   
   The mqtt production speed is higher than the consumption speed. When the 
blocking queue is filled, messages will be lost.
   
   ### Environment
   
   _No response_
   
   ### InLong version
   
   master
   
   ### InLong Component
   
   InLong Agent
   
   ### Are you willing to submit PR?
   
   - [X] Yes, I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@inlong.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to