title: ActiveMQ producer sending message from content inside PostgreSQL's table
body: <p>Is anyone have a reference for me for a ActiveMQ producer coding to sending messages from content inside a table in PostgreSQL, but i wish i can send all rows on the table become one-by-one message...
  I got a reference from someone that telling just same as i want above, but it tells how to get all the messages from content inside a .txt file...
  <a href="https://github.com/cybi/stackoverflow/blob/master/42432893/src/test/Main.java#L43" rel="nofollow noreferrer">here the referance</a> </p>
  
  <p>So far i got this:</p>
  
  <pre><code>package testMQDB;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.Statement;
  public class ProducerDB {
  
     public static void ProducerDB(String[] args){
         Connection c = null;
         Statement stmt = null;
         try {
         Class.forName("org.postgresql.Driver");
           c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/"TestDB, "admin", "admin");
           c.setAutoCommit(false);
           System.out.println("----------------------------");
  
           stmt = c.createStatement();
           ResultSet rs = stmt.executeQuery( "SELECT * FROM MESSAGES;" );
           while ( rs.next() ) {
              String  message = rs.getString("MESSAGE");
              System.out.println( "Message = " + message );
              if (message.equals(true)){
                  // write the ActiveMQ code here? 
              }
           }
           rs.close();
           stmt.close();
           c.close();
         } catch ( Exception e ) {
           System.err.println( e.getClass().getName()+": "+ e.getMessage() );
           System.exit(0);
         }
         System.out.println("----------------------------");
         System.out.println("Message sent successfully");
     }
  }
  </code></pre>