Skip to content

Commit c26da68

Browse files
authoredAug 27, 2024
Add topic name requirements; mv license and sec docs. (#386)
Signed-off-by: Paulo Alberto Simoes <paulo.simoes@oracle.com>
1 parent e7c55d8 commit c26da68

File tree

5 files changed

+37
-425
lines changed

5 files changed

+37
-425
lines changed
 

‎txeventq/okafka/Quickstart/README.md

+37-19
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ podman run --name=db23aifree \
4848
## Step 2: Setting database user password
4949

5050
All the steps in this lab can either be completed in sqlplus or sqlcl. The instructions refer to sqlcl but apart from the initial connection the two options
51-
are identical.
51+
are identical.
5252

5353
1. Start by *sql* and connect to the database PDB **FREEPDB1** as SYS
5454

5555
```shell
5656
sql /nolog
5757
```
58-
```roomsql
58+
59+
```roomsql
5960
CONNECT sys/"<Your Password>"@localhost:1521/FREEPDB1 as sysdba
6061
```
6162

@@ -91,49 +92,66 @@ CONNECT okafka_user/"<Your Password>"@localhost:1521/FREEPDB1
9192
```roomsql
9293
-- Create an OKafka topic named 'TXEQ' with 5 partition and retention time of 7 days.
9394
BEGIN
94-
dbms_aqadm.create_database_kafka_topic( topicname=> 'topic_1', partition_num=>5, retentiontime => 7*24*3600);
95+
dbms_aqadm.create_database_kafka_topic( topicname=> 'TOPIC_1', partition_num=>5, retentiontime => 7*24*3600);
9596
END;
9697
/
9798
```
9899

99100
> TIP:
100-
> - One can also use `KafkaAdmin` interface as shown in `OKafkaAdminTopic.java` in `Simple/Admin` directory to create a Transactional Event Queue.
101+
>
102+
> A Topic can also be created using OKAFKA Administration methods. Or, through the Producer interface which creates a new topic if it was not previously created.
103+
>
104+
> - You can also use `KafkaAdmin` interface as shown in `OKafkaAdminTopic.java` in `Simple/Admin` directory to create a Transactional Event Queue.
101105
102106
## Step 4: Investigate and Try Simple Producer and Consumer
103107

104108
The repository contains 2 common OKafka application examples in `Simple` folder.
105109

106110
1. The Producer `ProducerOKafka.java`
107111

108-
- Produces 10 messages into `topic_1` topic.
112+
- Produces 10 messages into `TOPIC_1` topic.
109113

110114
2. The Consumer `ConsumerOKafka.java`
111115

112-
- Consumes 10 messages from `topic_1` topic.
116+
- Consumes 10 messages from `TOPIC_1` topic.
113117

118+
### Task 1: Applications Configurations
114119

115-
### Task 1: Connection Configuration
120+
#### Connection Configuration
116121

117122
`OKafka` uses JDBC(thin driver) connection to connect to Oracle Database instance using any one of two security protocols.
118123

119-
1. PLAINTEXT
120-
2. SSL
124+
1. PLAINTEXT
125+
2. SSL
121126

122127
For this quickstart we will use PLAINTEXT.
123128

124129
1.PLAINTEXT: In this protocol a JDBC connection is setup by providing username and password in plain text in ojdbc.prperties file.
125130
To use PLAINTEXT protocol user must provide following properties through application. Edit file `config.properties` at `<Quickstart Directory>/Simple/[Producer|Consumer]/src/main/resources`
126131

127-
security.protocol = "PLAINTEXT"
128-
bootstrap.servers = "host:port"
129-
oracle.service.name = "name of the service running on the instance"
130-
oracle.net.tns_admin = "location of ojdbc.properties file"
132+
```text
133+
security.protocol = "PLAINTEXT"
134+
bootstrap.servers = "host:port"
135+
oracle.service.name = "name of the service running on the instance"
136+
oracle.net.tns_admin = "location of ojdbc.properties file"
137+
```
131138

132139
`ojdbc.properties` file must have below properties
133140

134-
user(in lowercase)=DatabaseUserName
135-
password(in lowercase)=Password
141+
```text
142+
user(in lowercase)=DatabaseUserName
143+
password(in lowercase)=Password
144+
```
145+
146+
#### APIs configuration
136147

148+
You can get a detailed description of the Producer, Consumer and Administration APIs in the [Kafka APIs for Oracle Transactional Event Queues Documentation](https://docs.oracle.com/en/database/oracle/oracle-database/23/adque/Kafka_cient_interface_TEQ.html#GUID-5549915E-6509-4065-B05E-E96338F4742C).
149+
150+
> Note: Topic name property should be provided in UPPERCASE.
151+
>
152+
>> ```text
153+
>> topic.name=<Oracle Database TxEventQ Topic, use uppercase>
154+
>> ```
137155
138156
### Task 2: Try the Producer
139157
@@ -195,10 +213,10 @@ You should see some output that looks very similar to this:
195213
13:33:42.413 [kafka-producer-network-thread | ] DEBUG org.oracle.okafka.clients.producer.internals.AQKafkaProducer -- [Producer clientId=] Found a publisher Session_Info:37,53002. Process Id:49814. Instance Name:FREE. Acknowledge_mode:0. for node 0:localhost:1521:FREEPDB1::
196214
13:33:43.125 [kafka-producer-network-thread | ] INFO org.oracle.okafka.clients.producer.internals.AQKafkaProducer -- [Producer clientId=] In BulkSend: #messages = 1
197215
13:33:43.711 [kafka-producer-network-thread | ] DEBUG org.oracle.okafka.clients.NetworkClient -- [Producer clientId=] Response Received Produce
198-
13:33:43.712 [kafka-producer-network-thread | ] INFO org.oracle.okafka.clients.producer.internals.SenderThread -- [Producer clientId=] Batch Send complete, evaluating response topic_1-0
216+
13:33:43.712 [kafka-producer-network-thread | ] INFO org.oracle.okafka.clients.producer.internals.SenderThread -- [Producer clientId=] Batch Send complete, evaluating response TOPIC_1-0
199217
.....
200218
.....
201-
13:33:48.192 [kafka-producer-network-thread | ] INFO org.oracle.okafka.clients.producer.internals.SenderThread -- [Producer clientId=] Batch Send complete, evaluating response topic_1-0
219+
13:33:48.192 [kafka-producer-network-thread | ] INFO org.oracle.okafka.clients.producer.internals.SenderThread -- [Producer clientId=] Batch Send complete, evaluating response TOPIC_1-0
202220
13:33:48.192 [kafka-producer-network-thread | ] DEBUG org.oracle.okafka.clients.producer.internals.SenderThread -- [Producer clientId=] Sender waiting for 100
203221
Last record placed in 0 Offset 9
204222
Initiating close
@@ -215,11 +233,11 @@ BUILD SUCCESSFUL in 17s
215233
3 actionable tasks: 3 executed
216234
```
217235

218-
And, querying the topic `topic_1` at the Database, you should see some output that looks very similar to this:
236+
And, querying the topic `TOPIC_1` at the Database, you should see some output that looks very similar to this:
219237

220238
```roomsql
221239
222-
SQL> select MSGID, ENQUEUE_TIME from topic_1;
240+
SQL> select MSGID, ENQUEUE_TIME from TOPIC_1;
223241
224242
MSGID ENQUEUE_TIME
225243
___________________________________ __________________________________

‎txeventq/okafka/Quickstart/SECURITY.md

-38
This file was deleted.

0 commit comments

Comments
 (0)
Failed to load comments.