c# - Oracle Advanced Queues - Dequeueing Commit/Rollback -
we're attempting use oracle aq build queueing system our app in .net 4.7.
basically, our problem wrap dequeueing process in upper level transaction containing other instructions , able commit or rollback "manually" after executing queue.dequeue() instruction.
so far, works enqueueing:
using (var tr = con.begintransaction()) { try { enqmsg.senderid = new oracleaqagent("subscriber1"); enqmsg.payload = new oraclexmltype(con, new xdocument( new xelement("workflowexecution", new xelement("id", i), new xelement("workflowname", guid.newguid().tostring().substring(0, 8)), new xelement("requestsource", guid.newguid().tostring().substring(0, 6)))).tostring()); queue.enqueue(enqmsg); //other instructions here... tr.commit(); } catch (exception) { tr.rollback(); } }
with same approach, trying perform
queue.dequeue()
and commit or rollback, doesn't seem work. here's dequeueing snippet:
//queue declaration queue = new oracleaqqueue("queuename", con) { messagetype = oracleaqmessagetype.xml, notificationconsumers = new[] { "subscriber1" }, dequeueoptions = { consumername = "subscriber1", dequeuemode = oracleaqdequeuemode.remove, visibility = oracleaqvisibilitymode.oncommit, } }; //dequeueing process using (var tr = con.begintransaction()) { try { oracleaqmessage _deqmsg = queue.dequeue(); //read payload var reader = _deqmsg?.payload xmltextreader; if (reader != null) { reader.read(); console.writeline("received message queue: " + reader.readouterxml()); } //further instructions... tr.commit(); } catch (exception ex) { tr.rollback(); } }
dequeueing commits transaction , removes messages permanently queue, when executing rollback instead of commit. has clue why not working dequeueing?
Comments
Post a Comment