Advertisements

Archive for February, 2015

SOA 12c – Using Maven for Service Bus deployment

In this post, we will see creation of Service Bus application and projects using maven archetypes. And we will use local Maven Repository for demonstration.

Generate Service Bus Application and Project as shown below.

mvn archetype:generate -DarchetypeGroupId=com.oracle.servicebus.archetype -DarchetypeArtifactId=oracle-servicebus-application -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.my.test -DartifactId=test-servicebus-application -DprojectName=test-servicebus-project -Dversion=1.0-SNAPSHOT

Import this maven project in JDeveloper using the steps mentioned below. Select File –> Import and select Maven Project option and click OK.

import1

osbimport

osbappl

osbimported

Open application level POM file in Application Resources directory as shown below and observe the details.

osbapplpom

osbapplpom1

Open project level POM file and observe the details.

osbprojpom

Open System level POM file and observe the details.

osbsyspom

Add plugin and other server details in project level POM files (both System and Service Bus Project) as shown below. Remember using the Admin Server port as the server url.

<build>
<plugins>
<plugin>
<groupId>com.oracle.servicebus.plugin</groupId>
<artifactId>oracle-servicebus-plugin</artifactId>
<version>12.1.3-0-0</version>
<configuration>
<oracleServerUrl>
http://localhost:7001</oracleServerUrl>
<oracleUsername>weblogic</oracleUsername>
<oraclePassword>weblogic1</oraclePassword>
</configuration>
</plugin>
</plugins>
</build>

You can generate the sbar file for your Service Bus Projects using mvn package (from directory of Service Bus Application) and can be found in <<project>>/.data/ maven.

sbuspackage

Deploy your Service Bus projects using mvn pre-integration-test (from Service Bus application directory).

sbuspinttest

You can execute Service Bus Plugin goals in following manner from directory containing project POM file.

mvn com.oracle.servicebus.plugin:oracle-servicebus-plugin:package

mvn com.oracle.servicebus.plugin:oracle-servicebus-plugin:deploy**

You can observe goal prefix as servicebus, when you describe Service Bus Plugin as shown below.

osbgoalprefix

so you can execute all goals simply using this goal prefix as below.

mvn servicebus:package

mvn servicebus:deploy**

 

**Currently facing issue with deploy goal.

 

Notes:

  • Use double quotes in the maven commands like below if you are seeing the error mentioned in think link.

mvn install:install-file "-DpomFile=oracle-maven-sync-12.1.3.pom" "-Dfile=oracle-maven-sync-12.1.3.jar" "-DoracleHome=C:/Oracle/Middleware/FMW1213New"

  • Seems to be OSB maven functionality is broken in 12.2.1. Refer to following blog talking about this.

https://rhpatrickblog.wordpress.com/2015/11/11/restoring-osb-12-2-1-maven-functionality/

Advertisements

SOA 12c – Using Maven for SOA deployment

In this post, we will see creation of SOA application/projects using the maven archetypes. And we will use local Maven Repository for the demonstration.

Navigate to %MW_HOME%\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3 and use following commands to sync your local repository:

mvn install:install-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom

mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=%MW_HOME%

Update your archetype catalog using:

mvn archetype:crawl -Dcatalog=C:\Users\<<uname>>\.m2\archetype-catalog.xml

Generate SOA Application and project as shown below. This generates SOA application test-soa-application with  project test-soa-project.

mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.my.test -DartifactId=test-soa-application -DprojectName=test-soa-project -Dversion=1.0-SNAPSHOT

Import this maven project in JDeveloper using File –> Import and select the Maven Project option as shown below. Click OK.

import1

Give your application directory as Root Directory which brings up all POMs and select other options as shown below. Click OK.

importmaven

Enter Application Name and click OK.

importappl

Click OK if you get any error related to overriding the existing project dialog so that jws file is created. Now your project explorer should look like as below.

importedprj

Open application level POM file in Application Resources directory as shown below and observe the details.

applpom1

applpom

Open project level POM file in Resources directory of SOA Project and observe the details.

projpom

Compile SOA Application using mvn compile (from directory of SOA Application).

compile

Modify server details in project level POM file as shown below and deploy your SOA projects using mvn pre-integration-test (from SOA application directory).

compilechng

After execution, you will see following output and also can observe the SOA project deployed to SOA server as shown below.

preintg

deployed

You can execute SOA Plugin goals in the following manner from the directory containing project POM file.

mvn com.oracle.soa.plugin:oracle-soa-plugin:compile

mvn com.oracle.soa.plugin:oracle-soa-plugin:sar

mvn com.oracle.soa.plugin:oracle-soa-plugin:deploy

mvn com.oracle.soa.plugin:oracle-soa-plugin:undeploy

You can observe goal prefix as oracle-soa, when you describe the SOA Plugin as shown below.

soagolaprefix

so you can execute all goals simply using this goal prefix as below.

mvn oracle-soa:compile

mvn oracle-soa:sar

mvn oracle-soa:deploy

mvn oracle-soa:undeploy

 

Note: Use double quotes in the maven commands like below if you are seeing the error mentioned in this link.

mvn install:install-file “-DpomFile=oracle-maven-sync-12.1.3.pom” “-Dfile=oracle-maven-sync-12.1.3.jar” “-DoracleHome=C:/Oracle/Middleware/FMW1213New”

SOA 12c – Using Maven Sync Plugin

Oracle recently released Maven Repository which is a giant leap in adopting Maven too for building, packaging and deploying SOA, ADF applications. You can access the repository here. To access this, you should be registered user with Oracle and accept the licensing terms.

In this post, we will see how to setup Archiva repositories and populate it with artifacts from Oracle Home. You can refer to Oracle FMW Continuous Integration documentation here for more information.

You can download the latest version of Archiva from here and corresponding documentation can be found here.

Archiva installation is so simple and you have to just unzip file contents. The standalone distribution comes up with bundled jetty server. By default, the server uses port 8000. You can always change this port to your desired value as shown below by modifying jetty.xml in conf directory.

serverport

Navigate to bin directory and start the server using the following command:

archiva console

serverstart

Once the server started, launch archiva using url http://localhost:8088. The first step is to create the admin user as shown below, so CreateAdmin User on the page launched. Enter the password and email and do Save.

admin

Now login using Admin credentials and navigate to Repositories which shows 2 default repositories as shown below.

defaultrepo

By default, the internal repository is for maintaining the fixed-version released artifacts includes finished versions of artifacts, versions that are no longer in development, and released versions. And the snapshot repository holds the work-in-progress artifacts denoted with a version having suffix SNAPSHOT, and artifacts that have not yet been released.

Here, we will create repositories keeping development environment in mind. It’s always recommended to create different repositories for DEV, QA and PROD as there is possibility of having different versions of same artifacts. For our purpose, we will reuse the snapshots repository and create 2 repositories mirror and dev. The mirror repository is used to cache third-party proxied artifacts and dev is used similar as internal repository.

Navigate to Repositories link and click Add. Set the properties similar to below.

mirrow

Click Save to go back to Managed Repositories page as shown below and here you can observe the new mirror repository.

repolistaftermirror

Create dev repository in similar way and make sure that you uncheck Block Redeployments as shown below.

devrepo

devlist

Archiva has a provision to create  Repository Groups, that allows to specify single URL instead of multiple repository URLs when we are using more than 1 repository.

Here we will create a repository group dev-group consisting of all the above. Navigate to Repository Groups and click Add.

repogrp

Give the name as dev-group and drag dev, snapshots and mirror repositories from Available list to left as shown below.

devgroup1

devgroup2

Click Save and observe the repository group as shown below.

repogrplist

Archiva uses proxy connector to link local repository with a remote repository. So when a request is received by repository, the connector decides whether it should request artifact from remote repository and cache the result locally for future requests.

By default, internal repository is connected to remote repository using Proxy Connector. This you can observe by navigating to Proxy Connectors as shown below.

pconndel

Since we want our mirror repository to proxy remote repository, delete the existing proxy connector. Click Add and create new Proxy Connector as shown below. Observe that Managed Repository is selected as mirror. Click Save.

pconncreate

With this, you have finished setting up required Archiva repositories.

By default, Oracle FMW installation comes up with Maven 3.0.5 and is available in following location. So set M2 and M2_HOME system variables accordingly.

%MW_HOME%\oracle_common\modules\org.apache.maven_3.0.5

Using Oracle Maven Sync Plugin

Navigate to the directory %MW_HOME%\oracle_common\plugins\maven\ com\oracle\ maven\oracle-maven-sync\12.1.3.

Install plugin:

mvn install:install-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom

 

Use the following as your user specific maven settings. Remember to modify the passwords in server elements.

 

Deploy plugin to dev Repository:

mvn deploy:deploy-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom  -Durl=http://localhost:8088/repository/dev  -DrepositoryId=dev

mavensync

Verifying Sync plugin:

mvn help:describe -Dplugin=com.oracle.maven:oracle-maven-sync –Ddetail

mvnsynchelp

Do the Sync:

mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=%MW_HOME% -DserverId=dev

You can verify the synced artifacts in dev repository as shown below

installed

Verifying SOA plugin

mvn help:describe -DgroupId=com.oracle.soa.plugin -DartifactId=oracle-soa-plugin -Dversion=12.1.3-0-0

soaplugin

Verifying Service Bus plugin

mvn help:describe -DgroupId=com.oracle.servicebus.plugin -DartifactId=oracle-servicebus-plugin -Dversion=12.1.3-0-0

sbusplugin

Note: Use double quotes in the maven commands like below if you are seeing the error mentioned in this link.

mvn install:install-file “-DpomFile=oracle-maven-sync-12.1.3.pom” “-Dfile=oracle-maven-sync-12.1.3.jar” “-DoracleHome=C:/Oracle/Middleware/FMW1213New”

SOA 12c–EDN with Service Bus

In this post, I just want to present an idea on how to make Service Bus work with EDN in SOA Suite 12c. For demonstration purpose, I will consider Durable Subscriber functionality introduced in 12c.

You can download the SOA and Service Bus projects here and here.

My setup includes 2 business events Create Order and Update Order and have the following durable subscribers created because of SOA Composites. Refer to these articles for more information on EDN. Note that, Client ID is different as mentioned below based on the consistency level used for the event subscription.

       For Guaranteed   -> edn_wljsm_localtx_client

       For OneandOnlyOne   -> edn_wljsm_xa_client

Main idea is to create a durable subscriber for our Proxy Service similar to the ones shown below. So note down Client ID and Message Selector shown below and use it in our Proxy Service configuration. Here we are subscribing our Proxy Service to Create Order business event.

soasubscr1

soasubscrmsgslet

Now create Proxy Service and set Endpoint URI in Transport tab as shown below. EDN uses EDN Topic for storing and delivering the EDN messages to subscribers.

topicps1

Give the Message Selector and Client ID noted in previous step in Transport Details tab as shown below and select Durable Subscription option.

topicps2

Deploy you Service Bus project and observe that another durable subscriber has been created for Proxy Service as shown below.

osbdura1

To make sure that things are working as expected, push the message read by Proxy service to other JMS queue. Here I created queue named CustomJmsQ and following screenshot shows no messages are pushed yet.

customqmsg

Raise the Create Order business event from SOA Composite. And you can observe that message payload have been inserted into JMS queue.

custommsgaftrtest

evntpayloadjms

Shut down OSB managed server and observe status of  durable subscriber. As shown below the Active status is shown as false indicating that Proxy service is not longer ready to accept messages.

osbinactive

Again raise the Create Order business event. And now you can observe that message is shown in Current Count means not yet delivered to Proxy Service.

pendingmsg

pendingmsg1

Now restart your OSB managed server navigate to CustomJmsQ. Now you can observe 2 messages in this queue including the latest one as shown below.

osbsrvrrestart1

osbsrvrrestart2

Now Un-deploy Service Bus project. And you can observe that corresponding durable subscriber is deleted too.

Remember the following:

  • EDN bus comes with SOA server, so you may not be able to use EDN in OSB only deployments.
  • Since there is no native support for business events in service bus, we will not be able to set any consistency levels and even the retry would not happen similar to SOA composites.
  • Here we directly gave Endpoint URI of Proxy Service to point to EDNTopic residing different server. Ideally, you may have to go for foreign server.
  • Finally, I have not verified the same with client edn_wlsjms_xa_client. Please let me know in comments when you try.

Advertisements

Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 327 other followers

Enter your email address to follow this blog and receive notifications of new posts by email.