After subscribing, you will see an entry in the ACTIVEMQ_ACKS table…
SQL> select container,client_id from esb.activemq_acks; CONTAINER CLIENT_ID ---------------------------------------- ---------------------------------------- topic://testTopic me topic://testTopic mysubscriber topic://testTopic mysubscriber2 SQL>
Once unsubscribe has been run on the subscriber…
ConnectionFactory connectionFactory=new ActiveMQConnectionFactory("admin", "admin", "tcp://localhost:61616"); Connection connection = connectionFactory.createConnection(); connection.setClientID(args[0]); connection.start(); Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); if (args[1].equals("unsubscribe")) { session.unsubscribe("testTopic"); System.out.println("unsubscribed"); System.exit(0); }
…you will no longer see an entry in the ACTIVEMQ_ACKS table…
SQL> select container,client_id from esb.activemq_acks CONTAINER CLIENT_ID ---------------------------------------- ---------------------------------------- topic://testTopic mysubscriber topic://testTopic mysubscriber2 SQL>
A database trace will show what is below…
#------------------------------------------------------------------- 2016-05-18 19:03:01.327785 12280 milliseconds since the previous top level execution statement. LINE# = 1381 DELETE FROM ACTIVEMQ_ACKS WHERE CONTAINER=:1 AND CLIENT_ID=:2 AND SUB_NAME=:3 select obj#, name, stab#, sobj#, sobjd#, ttab#, tobj#, tobjd#, mflags from rmtab$ where (stab# = :1 or ttab# = :1) order by obj# select binaryDefVal, lengthb(binaryDefVal), guard_id from ecol$ where tabobj# = :1 and colnum = :2 #------------------------------------------------------------------- 2016-05-18 19:03:01.336822 9 milliseconds since the previous top level execution statement. LINE# = 1404 SELECT COUNT(*) FROM ACTIVEMQ_MSGS M, ACTIVEMQ_ACKS D WHERE D.CONTAINER=:1 AND D.CLIENT_ID=:2 AND D.SUB_NAME=:3 AND M.CONTAINER=D.CONTAINER AND M.ID > ( SELECT LAST_ACKED_ID FROM ACTIVEMQ_ACKS WHERE CONTAINER=D.CONTAINER AND CLIENT_ID=D.CLIENT_ID AND SUB_NAME=D.SUB_NAME ) #-------------------------------------------------------------------
…with the following for bind variable values when the backing store is an Oracle database…
BINDS #139635352651880: Bind#0 oacdty=01 mxl=128(68) mxlc=00 mal=00 scl=00 pre=00 oacflg=03 fl2=1000010 frm=01 csi=873 siz=288 off=0 kxsbbbfp=7eff63981148 bln=128 avl=17 flg=05 value="topic://testTopic" Bind#1 oacdty=01 mxl=32(08) mxlc=00 mal=00 scl=00 pre=00 oacflg=03 fl2=1000010 frm=01 csi=873 siz=0 off=128 kxsbbbfp=7eff639811c8 bln=32 avl=02 flg=01 value="me" Bind#2 oacdty=01 mxl=128(36) mxlc=00 mal=00 scl=00 pre=00 oacflg=03 fl2=1000010 frm=01 csi=873 siz=0 off=160 kxsbbbfp=7eff639811e8 bln=128 avl=09 flg=01 value="testTopic"