Build an Integrated Extract using JSON

Now that Oracle GoldenGate 12.3 Microservices have been out for about 9 month; there seems to be more and more discussions around how microservices can be used. The mircoservices architecture provides a faster way for users to build extract, replicats, distribution paths and many other items by using a JSON document and simply calling a REST end-point.

In this post, I’ll show you how to build an integrated extract using JSON and REST APIs. First think you need to understand, is the steps that it takes to build an extract currently in GGSCI/AdminClient.

Note: AdminClient can be used, with debug on, to see how these commands translate back into JSON and REST calls.

To build an Integrated Extract via GGSCI/AdminClient:

1. add extract exttst, integrated, begin now
2. register extract exttst, database container pdb1
3. add exttrail aa, extract exttst, megabytes 250
4. start extract exttst

As you can tell, it takes 4 steps to add and start the extract to an Oracle GoldenGate configuration.

If your a command line geek or a developer who wants to do more with Oracle GoldenGate, the mircroservices architecture provides you a way to build an extract via JSON files. A simple JSON file for building an integrated extract looks as follows:

{
“description”:”Integrated Extract”,
“config”:[
“Extract EXTTST”,
“ExtTrail bb”,
“UseridAlias SGGATE”,
“Table SOE.*;”
],
“source”:{
“tranlogs”:”integrated”
},
“credentials”:{
“alias”:”SGGATE”
},
“registration”:{
“containers”: [ “pdb1” ],
“optimized”:false
},
“begin”:”now”,
“targets”:[
{
“name”:”bb”,
“sizeMB”:250
}
],
“status”:”stopped”
}

This JSON example, describes all the attributes needed to build an integrated extract. The main items in this JSON are:

Description – Provide a description for the parameter file
Config – Details for the associated parameter file
Source – Where the extract should read transactions from
Credentials – What credentials in the credential stores should be used
Registration – Register the extract with the database and against associated pdbs
Begin – At what timeframe the extract should start
Targets – What trail files the extract should write to
Status – If the extract should be started or not

These 8 categories cover what we traditioanlly did in the classic architecture in 3 steps. With all these items in the JSON file, you can now quickly build the extract by calling a simple curl command.

In order to build the extract, you need to know the REST API end-point that is needed. All extracts are built against the Administration Server (AdminService) within the microservices architecture. In my configuration, my AdminService is running on port 16000; so the REST API end-point would be:

{{Source_AdminServer}}/services/v2/extracts/{{extract_name}}

http://localhost:16000/services/v2/extracts/EXTTST

The REST API end-point, requires you to specify the extract name in the URL. Now with the URL and associated JSON, you can create an extract with a simple cURL command or embed the call into an application. An example of a cURL command that would be used is:

curl -X POST \
http://localhost:16001/services/v2/extracts/EXTTST\
-H ‘Cache-Control: no-cache’ \
-d ‘{
“description”:””,
“config”:[
“Extract EXTTST”,
“ExtTrail bb”,
“UseridAlias SGGATE”,
“Table SOE.*;”
],
“source”:{
“tranlogs”:”integrated”
},
“credentials”:{
“alias”:”SGGATE”
},
“registration”:{
“containers”: [ “pdb1” ],
“optimized”:false
},
“begin”:”now”,
“targets”:[
{
“name”:”bb”,
“sizeMB”:250
}
],
“status”:”stopped”
}’

Once the extract is created, you will notice that the extract is stopped. This is due to the “status” that was feed through the JSON document. You should be able to start the extract and start seeing transactions being extracted.

Enjoy!!!

Please follow and like:

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.