Maven Coordinates
To enable AQ Connector add the following dependency to your project’s pom.xml (see Managing Dependencies).
<dependency>
<groupId>io.helidon.messaging.aq</groupId>
<artifactId>helidon-messaging-aq</artifactId>
</dependency>content_copy
Reactive Oracle AQ Connector
Sending and receiving
Example of producing to and consuming from Oracle AQ:
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pds.setURL("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.0.123)(Port=1521))(CONNECT_DATA=(SID=XE)))");
pds.setUser("frank");
pds.setPassword("frank");
AqConnector seConn = AqConnector.builder()
.dataSource("test-ds", pds)
.build();
Channel<String> toAq = Channel.<String>builder()
.name("toAq")
.subscriberConfig(AqConnector.configBuilder()
.queue("example_queue_1")
.dataSource("test-ds")
.build())
.build();
Channel<String> fromAq = Channel.<String>builder()
.name("fromAq")
.publisherConfig(AqConnector.configBuilder()
.queue("example_queue_1")
.dataSource("test-ds")
.build())
.build();
Messaging.builder()
.connector(seConn)
.publisher(toAq, Multi.just("Hello", "world", "from", "Oracle", "DB!").map(Message::of))
.listener(fromAq, s -> System.out.pritln("Message received: "+s))
.build()
.start();content_copy
- Prepare Oracle UCP
- Setup AQ connector and provide datasource with an identifier
test-ds - Setup channel for sending messages to queue
example_queue_1with datasourcetest-ds - Setup channel for receiving messages from queue
example_queue_1with datasourcetest-ds - Register connector and channels
- Add a publisher for several test messages to publish them to
example_queue_1immediately - Subscribe callback for any message coming from
example_queue_1