fatherazrael
fatherazrael

Reputation: 5987

Oracle Advance Queue and Java: Able to send message through code but not able to see in queue table

Tried to send a message to the queue using the Java Code available on the Oracle website. The code ran successfully but I can't see any record in the db.

    static String myJson =
                "Hello Message"; 
                
        public static void runTest(AQSession aq_sess) throws AQException
        {
              AQQueueTable             q_table;
             AQQueue                  queue;
             AQMessage                message;
             AQRawPayload             raw_payload;
             AQEnqueueOption          enq_option;
             String                   test_data = myJson;
             byte[]                   b_array;
    
             /* Get a handle to queue table - aq_table4 in aqjava schema: */
    //       q_table = aq_sess.getQueueTable ("MASTERDATA", "TEST_TABLE");
    //       System.out.println("Successful getQueueTable");  
    
             /* Get a handle to a queue - aq_queue4 in aquser schema: */
    //       queue = aq_sess.getQueue ("APPS", "XXEDGE_CONTACT_TO_QUE");
             queue = aq_sess.getQueue ("MASTERDATA", "TEST_QUEUE");
             System.out.println("Successful getQueue");  
    
             /* Create a message to contain raw payload: */
             message = queue.createMessage();
             
             AQMessageProperty amq = message.getMessageProperty();
             amq.setExpiration(10000l);
             amq.setSender(new AQAgent("Gren", "",0));
             /* Get handle to the AQRawPayload object and populate it with raw data: */
             System.out.println(test_data);
             b_array = test_data.getBytes();
             
             raw_payload = message.getRawPayload();
             System.out.println(b_array.length);
             raw_payload.setStream(b_array, b_array.length);
             System.out.println("Queue");
             /* Create a AQEnqueueOption object with default options: */
             enq_option = new AQEnqueueOption();
             
             /* Enqueue the message: */
             queue.enqueue(enq_option, message);
             System.out.println("EnQueued");
        }

enter image description here

enter image description here

enter image description here

Any suggestion where the message is lost?

Upvotes: 0

Views: 245

Answers (1)

fatherazrael
fatherazrael

Reputation: 5987

It is important to commit the connection after enqueue.

I have entered commit statement and it worked.

Upvotes: 0

Related Questions