Giter Site home page Giter Site logo

hikari-oracle-aq's Introduction

hikari-oracle-aq

Example code of hooking up Oracle AQ over Spring with HikariCP data source

Since the oracle driver code assumes the use of an Oracle specific DataSource, it can be a bit of a hassle getting it to work with a different datasource. The friendly people at spring developed the NativeJdbcExtractors for that (as described here). In the HikariWrappingDataSource created connections are wrapped by a class implements the internal.OracleConnection interface. It forwards all Connection calls directly to the Connection and all OracleConnection specific calls to the connection retrieved via the NativeJdbcExtractor.

When is this a good idea?

In general probably not, since AQ connections are kept active and open all the time there is no good reason including them in a connection pool. You're probably better served defining an oracle source for your AQ connection and using that source also as input for the Hikari connection pool.

However, we also had a large codebase of Oracle StoredProcedure mapping which also needed the OracleConnection internals, so for our code this was currently the best solution. If you have the same situation, it could work for you as well.

Database requirements

The test code assumes the existence of a table called TEST_TABLE with a single column that accepts numbers or varchars. It also needs a queue to exist with the name TEST_QUEUE. This should reside in the schema configured in hiraki.properties

Code structure

  • Maven module in hikari-oracle-aq directory
  • All code resides in the com.bartenkelaar.hikari package.
  • hikari.properties contains all properties read by the code.
  • log4j.properties contains logger configuration.
  • Application is the main class and configuration file.
  • Spring bean configuration for the data source and JMS setup is in DataSourceConfig and JmsConfig respectively.
  • HikariWrappingDataSource is the subclass of HikariDataSource that wraps the connections in an in inner WrappedConnection
  • TestListener is a JMS listener on the TEST_QUEUE table that inserts the messages directly into TEST_TABLE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.