January 1, 2017

Step by Step 1 Hour Guide

It only takes 1 hour and a few simple steps to install and start using GenericParallel. Do it now!

Please note: this guide project is available for your reference as an OSB project within the distribution ZIP under name QuickStart.jar.

STEP 1. Download GenericParallel

Extracted GenericParallel distribution

Extracted GenericParallel distribution

Download the distribution ZIP and extract it into a temporal working directory.

STEP 2. Import Into OEPE (Eclipse)

OSB project before importing GenericParallel

OSB project before importing GenericParallel

In Eclipse/OEPE, open Oracle Service Bus perspective.

Open Project Explorer if it is not opened by default.

Importing JAR

Importing JAR

Right-click on OSB configuration project (QuickStart in this case).

Hover the mouse over Import menu item, and in the opened sub-menu click Oracle Service Bus - Configuration Jar.

Selecting JAR file

Selecting JAR file

Select GenericParallel-x.x.x.jar from the directory where you’ve extracted the ZIP into.

Click Next.

Completing importing JAR file

Completing importing JAR file

Make no changes to the Preserve… checkboxes.

Click Finish to complete the import.

Import is completed

Import is completed

Import is completed.

GenericParallel is visible in the list of projects and ready to be used.


STEP 3. Prepare Services To Call

Services to call

Services to call

If you haven’t done that yet, make the services GenericParallel will be calling.

GenericParallel can call OSB Business and Proxy services.

In the example below we’re going to call Internet, Mobile and TV account proxy services.

For QuickStart project those services are mocks, i.e. do not call any real backends.


STEP 4. Make Entry Proxy

Entry Proxy

Entry Proxy

Create an entry OSB proxy which will be called by the consumers.

The entry proxy will use GenericParallel to call three account proxy services.

In the example below the proxy is called CompositeAccount.

Proxy Overview

Proxy Overview

In the request pipeline build the GPS request containing 3 requests to Internet, Mobile and Television account services. (see Step 5 below)

Route the proxy to GenericParallel local proxy located at GenericParallel/GenericParallel path, with operation DoInParallel. (see Step 6 below)

In the response pipeline build the CompositeAccount response out of 3 separate account services responses. (see Step 7 below)


STEP 5. Make List Of Requests

Let’s assume the request to the CompositeAccount looks like this

<AccountRequest>
  <UniversalAccountNo>12345</UniversalAccountNo>
</AccountRequest>

In the request pipeline of CompositeAccount proxy replace the Body content with the result of an XQuery that builds a GenericParallel request to call all three account services.

<typ:GPS xmlns:typ="http://genericparallel/types">
  <typ:Requests>

   <typ:Request GPSTarget="AccountServices/Backends/InternetAccount">
     <InternetAccountRequest>
       <AccountNo>{$body/AccountRequest/UniversalAccountNo/text()}</AccountNo>
     </InternetAccountRequest> 
   </typ:Request> 

   <typ:Request GPSTarget="AccountServices/Backends/MobileAccount"> 
     <MobileAccountRequest> 
       <AccountNo>{$body/AccountRequest/UniversalAccountNo/text()}</AccountNo> 
     </MobileAccountRequest> 
   </typ:request> 

   <typ:Request GPSTarget="AccountServices/Backends/TelevisionAccount"> 
     <TVAccountRequest> 
       <AccountNo>{$body/AccountRequest/UniversalAccountNo/text()}</AccountNo> 
     </TVAccountRequest> 
   </typ:Request> 

  </typ:Requests> 
</typ:GPS>

In the example above each section contains one request to a backend service. It is routed to the appropriate service using GPSTarget attribute of the Request element.

The content under Request element is the body of the request as it would be provided under soap:Body element in a SOAP call.

All three requests are populated with the account number passed in the composite AccountRequest.


STEP 6. Route To GenericParallel

Route to GenericParallel

Route to GenericParallel

In our example, GenericParallel is called via a Route node.

Service Callout or Publish would work too, of course.


STEP 7. Make Composite Response

GenericParallel calls all three backend services (concurrently) and returns us a list of responses.

<types:GPSResponse xmlns:types="http://genericparallel/types">
  <types:Responses>

    <types:Response GPSIndex="1" GPSBatchIndex="1">
      <soap-env:Envelope>
        <soap-env:Body>
          <InternetAccountResponse>
          <AccountId>b123456</AccountId>
          <UsageGigabytes>24</UsageGigabytes>
          <DownloadSpeed>30</DownloadSpeed>
          <UploadSpeed>8</UploadSpeed>
          </InternetAccountResponse>
        </soap-env:Body>
      </soap-env:Envelope>
    </types:Response>

    <types:Response GPSIndex="2" GPSBatchIndex="1">
      <soap-env:Envelope>
        <soap-env:Body>
          <MobileAccountResponse>
          <AccountId>mob33456</AccountId>
          <UsageMinutes>417</UsageMinutes>
          <UsageMegabytes>124</UsageMegabytes>
          </MobileAccountResponse>
        </soap-env:Body>
      </soap-env:Envelope>
    </types:Response>

    <types:Response GPSIndex="3" GPSBatchIndex="1">
      <soap-env:Envelope>
        <soap-env:Body>
          <TVAccountResponse>
          <AccountId>tvzaxb1t</AccountId>
          <Packages>
            <Package>1</Package>
            <Package>24</Package>
            <Package>31</Package>
          </Packages>
          </TVAccountResponse>
        </soap-env:Body>
      </soap-env:Envelope>
    </types:Response>

  </types:Responses>
</types:GPSResponse>

Convert it into composite AccountResponse with XQuery and replace the Body content with the result.

<AccountResponse>
    <Internet>
        {$body//gps:Response[1]/soap-env:Envelope/soap-env:Body/InternetAccountResponse/*}
    </Internet>

    <Mobile>
        {$body//gps:Response[2]/soap-env:Envelope/soap-env:Body/MobileAccountResponse/*}    
    </Mobile>

    <TV>
        {$body//gps:Response[3]/soap-env:Envelope/soap-env:Body/TVAccountResponse/*}    
    </TV>
</AccountResponse>

Note that the responses’ order is matching the order of requests, so we can use Response[1] notation.

Client then gets the composite response like the one below:

<AccountResponse>
    <Internet>
        <AccountId>b123456</AccountId>
        <UsageGigabytes>24</UsageGigabytes>
        <DownloadSpeed>30</DownloadSpeed>
        <UploadSpeed>8</UploadSpeed>
    </Internet>
    <Mobile>
        <AccountId>mob33456</AccountId>
        <UsageMinutes>417</UsageMinutes>
        <UsageMegabytes>124</UsageMegabytes>
    </Mobile>
    <TV>
        <AccountId>tvzaxb1t</AccountId>
        <Packages>
            <Package>1</Package>
            <Package>24</Package>
            <Package>31</Package>
        </Packages>
    </TV>
</AccountResponse>

STEP 8. Enjoy!

You’re done, and it all took less than an hour!

Vladimir Dyuzhev, author of GenericParallel

About Me

My name is Vladimir Dyuzhev, and I'm the author of GenericParallel, an OSB proxy service for making parallel calls effortlessly and MockMotor, a powerful mock server.

I'm building SOA enterprise systems for clients large and small for almost 20 years. Most of that time I've been working with BEA (later Oracle) Weblogic platform, including OSB and other SOA systems.

Feel free to contact me if you have a SOA project to design and implement. See my profile on LinkedIn.

I live in Toronto, Ontario, Canada.  canada   Email me at info@genericparallel.com