You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using our code generator, we should implement a couple of awesome features around Oracle AQ. It should be very easy to dequeue a message from such a queue.
SQL types:
CREATE OR REPLACETYPEbook_tAS OBJECT (
ID NUMBER(7),
title VARCHAR2(100CHAR),
language VARCHAR2(2CHAR)
);
/CREATE OR REPLACETYPEbooks_tAS VARRAY(32) OF book_t;
/CREATE OR REPLACETYPEauthor_tAS OBJECT (
ID NUMBER(7),
first_name VARCHAR2(100CHAR),
last_name VARCHAR2(100CHAR),
books books_t
);
/CREATE OR REPLACETYPEauthors_tAS VARRAY(32) OF author_t;
/
The serialisation and deserialisation of nested OBJECT and TABLE, VARRAY types already works out of the box with stored procedures, in jOOQ. What's new is the fact that:
AQ references are generated and reference the relevant payload OBJECT type
Blocking enqueue() and dequeue() calls will be made available to users
More usage examples:
@TestpublicvoidtestAQSimple() throwsException {
// Enqueue all authorsauthors.stream().forEach(a -> {
DBMS_AQ.enqueue(dsl.configuration(), NEW_AUTHOR_AQ, a);
});
// Dequeue them againauthors.stream().forEach(a -> {
assertEquals(a, DBMS_AQ.dequeue(dsl.configuration(), NEW_AUTHOR_AQ));
});
}
@TestpublicvoidtestAQTransactions() throwsException {
dsl.transaction((ctx) -> {
ENQUEUE_OPTIONS_Tenq = newENQUEUE_OPTIONS_T().visibility(IMMEDIATE);
// Enqueue two authorsDBMS_AQ.enqueue(dsl.configuration(), NEW_AUTHOR_AQ, authors.get(0), enq);
DBMS_AQ.enqueue(dsl.configuration(), NEW_AUTHOR_AQ, authors.get(1), enq);
// Dequeue them againDEQUEUE_OPTIONS_Tdeq = newDEQUEUE_OPTIONS_T().wait(NO_WAIT);
assertEquals(authors.get(0), DBMS_AQ.dequeue(dsl.configuration(), NEW_AUTHOR_AQ, deq));
assertEquals(authors.get(1), DBMS_AQ.dequeue(dsl.configuration(), NEW_AUTHOR_AQ, deq));
// The queue is empty, this should failassertThrows(DataAccessException.class, () -> {
DBMS_AQ.dequeue(dsl.configuration(), NEW_AUTHOR_AQ, deq);
});
});
}
The text was updated successfully, but these errors were encountered:
Using our code generator, we should implement a couple of awesome features around Oracle AQ. It should be very easy to dequeue a message from such a queue.
SQL types:
Queue config
Generated AQ references:
Usage:
Sample output:
Remarks
The serialisation and deserialisation of nested
OBJECT
andTABLE
,VARRAY
types already works out of the box with stored procedures, in jOOQ. What's new is the fact that:OBJECT
typeenqueue()
anddequeue()
calls will be made available to usersMore usage examples:
The text was updated successfully, but these errors were encountered: