title: How to identify duplicate messages while adding to Activemq queue
body: <p>I am setting up JMS using ActiveMq in spring boot application. But unable to understand how to prevent sender (Message provider) to adding duplicate messages to queue.</p>
  
  <p><strong>My application initial JMS and message converter beans configuration as follows</strong></p>
  
  <pre><code>@Bean
      public Queue queue() {
          return new ActiveMQQueue("pendingDocuments.queue");
      }
  
  
  @Bean 
   public MessageConverter jacksonJmsMessageConverter() {
         MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
              converter.setTargetType(MessageType.TEXT);
              converter.setTypeIdPropertyName("_type");
              return converter;
          }
  </code></pre>
  
  <p><strong>Sender method implementation</strong></p>
  
  <pre><code>@Autowired
  private JmsMessagingTemplate jmsMessagingTemplate;
  
  @Autowired
  private Queue pendingDocumentsQueue;
  
  public void getPendingDocuments(){
  
  /*My Custom Java Object, Actually these objects will read from DB for every 5 min, so process no way to know either these are already added to queue or not*/
  
  Document document= new Document();
  document.setUniqueId("122212");
  document.setContent("TEST CONTENT");
  this.jmsMessagingTemplate.convertAndSend(this.pendingDocumentsQueue, document);
  
          }
  </code></pre>
  
  <p>I would like to know how can we add messages (my document object) to queue based on document unique id.</p>