Oracle AQ java implementation of enque/deque

1.4k Views Asked by At

I have been searching over the internet past few days for any running sample implementation of Oracle Adavanced Queue for enque/deque of messages, but haven't had any success.

I was trying to follow the specification mentioned oracle documentation on this, but it's little unclear to me.

  • It doesn't have any information about the dependencies to use (maven/gradle) available publicly. [I came to know that I need to use aqapi.jar] . Any specific version compatible with the jdbc driver I am using.

  • I am also using c3p0 connection pooling for this and looking for any support of AQSession out of the box for the c3p0 to avoid connection and session handling from code perspective.

Note: The queue table and the queue is already setup from the database layer. I am just trying to write a producer/consumer to message delegation. we are using oracle 12c and Java 11.

Any sort of information would be really appreciated.

1

There are 1 best solutions below

2
Jean de Lavarene On

All you need is the Oracle JDBC thin driver (ojdbc) to do AQ operations such as enqueue or dequeue. See the Oracle JDBC Javadoc for more details about the APIs. Please also checkout this other question on stackoverflow for some code samples: How to enqueue on Oracle AQ table on commit with Java and consume with a JMS client

Note you have two options: a) either use the AQ APIs directly or b) use AQ-JMS if you want to use the JMS APIs instead.

aqapi.jar is only needed for admin purposes like "create a queue", "start a queue", etc. Otherwise you don't need it.