Oracle AQ over HikariCP

685 views
Skip to first unread message

Bart Enkelaar

unread,
Jan 31, 2016, 9:12:04 AM1/31/16
to hika...@googlegroups.com
Hey all!

I've been trying to get Oracle AQ to work over HikariCP. The main problem I ran in to was that in Oracle's Topic & Queue connection factories Oracle casts the connections retrieved from the DataSource to OracleConnections and even internal.OracleConnections.

After asking a colleague with lots of Spring experience he pointed me to the NativeJdbcExtractors as an option to circumvent this problem (Basically create wrappers for the Connections that are also OracleConnections I believe)

Functionally this seems to work fine, but now the Hikari connection pool no longer seems to release the connections, so once it runs in to the max connections limit it will no longer handle any Database requests.

I've created a small project showcasing what I've tried and the problem I run in to. It's at https://github.com/benkelaar/hikari-oracle-aq

If someone could take a look at my code and point me in the direction of why it doesn't work right now that would be awesome.

Thanks a lot!
Bart Enkelaar

Bart Enkelaar

unread,
Jan 31, 2016, 9:18:43 AM1/31/16
to HikariCP
Right, as an addendum:
Basically what I did was subclass the HikariDataSource and every time getConnection was called I wrap it through a call to NativeJdbcExtractor#getNativeConnection.


NativeJdbcExtractor comes from spring-jdbc.

Regards, Bart Enkelaar

Bart Enkelaar

unread,
Jan 31, 2016, 10:58:58 AM1/31/16
to hika...@googlegroups.com
OK, I think I figured out what went wrong. Since Hikari uses the HikariProxyConnection to track the closing of the connections it is important that close is actually called on those connections. Since the NativeJdbcExtractor extracts the OracleConnection instead of wrapping it (As I first thought it did) you lose that functionality by doing it the way I did now, meaning the Hikari connection pool correctly breaks.

I can probably achieve this by writing a wrapper that forwards all oracle connection calls to the internal oracle connection and the rest normally to the hikari connection, but it's a bit more verbose (Lombok to the rescue, but @Delegate is a bit of a shaky feature).

Do you think there's another way I can achieve this?

Regards, Bart Enkelaar

--
You received this message because you are subscribed to a topic in the Google Groups "HikariCP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hikari-cp/vlDnC1v1Nc0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hikari-cp+...@googlegroups.com.
Visit this group at https://groups.google.com/group/hikari-cp.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages