我正在尝试使用Oracle AQ和VB.NET进行事务。阅读消息并尝试提交时,它不起作用。事务将被完全忽略,并且消息以状态UNREAD保留在队列中。缺少什么吗?
Public Sub TestDequeueRollback()
Dim constr = String.Format("user id={0};password={1};data source={2}", "HR", "HR", "ORCLPDB")
Dim connection = New OracleConnection(constr)
connection.Open()
Dim transaction = connection.BeginTransaction
Dim queue = New OracleAQQueue("HR.SRUMSGIN20", connection)
queue.DequeueOptions.Visibility = OracleAQVisibilityMode.OnCommit
queue.DequeueOptions.Wait = 3
queue.DequeueOptions.DequeueMode = OracleAQDequeueMode.Locked
queue.MessageType = OracleAQMessageType.Udt
queue.UdtTypeName = "SYS.AQ$_JMS_BYTES_MESSAGE"
Dim message = queue.Dequeue()
transaction.Commit()
queue.Dispose()
connection.Close()
connection.Dispose()
End Sub