Friday, October 31, 2014

Oracle MFT 12c: Getting started with Oracle Manage File Transfer 12c

In large organization sometimes there is a requirement to transfer the files from one location to another location and file in source location is in different format than at destination for example at source destination the file may be .zip and in the destination you have to save in .xml. Oracle Managed File Transfer is one of the utility which provide this functionality and many more.

Oralce MFT Features

  • You can schedule the file transfer.
  • Resubmitting the transfer to redeliver the file.
  • Compression and decompression of file.
  • Encryption and decryption of files.
  • Archiving, renaming and deletion.
  • you can pause and resume the file transfer.
  • Detailed auditing and reports of file transfer.
  • Transfer of files from single source to multiple targets.

Components of Oracle MFT

Oracle MFT Artifacts

There are three main artifacts which are used for Managed File Transfer:

Source: It defines the origin of file i.e. location of the file which is going to picked by MFT server.

Transfer: This artifacts links one source to one or more targets. You can also create the content filters or can perform the actions like encryption/decryption or compresseion/decompression.

Targets: It is the destination location where the transfer put the file or the content.



Embedded Ftp and sFtp server in weblogic

In Oracle MFT 12c these two servers are embedded to weblogic can be used as one of the source artifacts, you need to configure host, port, user access to the directories in the MFT console as shown below:

By default the Ftp server is up and running, the only thing required for the Ftp server is location i.e. you have to pass the source location of files, default location is set to /u01/app/oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/mft/ftp_root/payloads. You can change this location if you want.

Monitoring and Reports

In Oracle MFT you get the separate page view or dashboard to monitor the mft instances. You can closely watch Source, Transfer and Targets instances separately. You can monitor the following things:

  • Success and failure instances for the source, transfer and target. You can also check the frequency of the statistics.
  • Dashboard got the separate error information table, so you can easily locate the error instances.
  • Separate view of active deliveries progress table.
  • Report generation for all or individual deliveries.


References:

http://docs.oracle.com/middleware/1213/mft/MFTUG/mftug_intro.htm#MFTUG269
http://docs.oracle.com/middleware/1213/mft/MFTUG/mftug_monitor.htm#CHDDGDAH


Wednesday, October 29, 2014

Oracle SOA: Sync Read of file in Oracle SOA using File Adapter

I was working on one of the requirement in which we need to read the file in between the Bpel process i.e. File Adapter is not triggering the bpel process but inside the bpel process file adapter is triggered to get the file.
Here in this post I am taking a small example to make you guys understand that what this option in file adapter means.

Scenario

In my example I am using a two file adapters one is writing of file and other is sync read of file. Well writing file adapter I used just to create a xml file so that I don't have to create manually. In the second adapter i.e. Sync Read File adapter I am passing the name of the file that is created by write file adapter. I put the same directory for write and read i.e. "G:\Anshul\SyncRead" and for archiving "G:\Anshul\Archive\SyncRead".

Steps:

  1. Create SOA Application and then SOA project.
  2. Create schema file, I have created Info.xsd.
  3. Drag n drop, File Adapter to reference lane and configure for write operation.
  4. Again drag n drop File Adapter to configure Sync Read File operation

  5. Create Bpel Process and exposed this bpel process as SOAP webservice. 
  6. After that wired all the components and you composite looks like below.
  7. Now Inside the bpel process, assign the filename to write the file and same file name to be passed to Sync Read File adapter. 
  8. Create a local variable i.e. FileNameVar and put the value concat("Info_",ora:getComponentInstanceId,".xml") this is xpath function which generates the file name like Info_10001.xml
  9. Now pass the above file name in Invoke activity of both the file adapter.
  10. Apply the Request/Response transformation to invoke variables.
  11. Save, deploy and test.
You can download the code from here : com.codeconfuse.soa.FileSyncRead

Monday, October 27, 2014

How to uninstall default open jdk in Oracle Linux

When you install linux OS on either virtual machines or physical machines then it comes with open jdk version 1.6 or 1.7 or both (In my case both on oracle linux 6.5). Well this is not a problem but sometimes you required to install the products (OSB, SOA, Weblogic etc.) which is certified with different jdk vendor or version. In that case you are required to remove the open jdk and install the jdk version you required (although you can install the new jdk version without removing older one i.e. you need to set the environment variable JAVA_HOME which is pointing to new jdk).

Here are the steps:

Check JDK installation

Run the command: java -version


Removing JDK

Run the command: yum remove java*

This command will search for all the java version and will show you all the available jdk version and ask for permission if you want to remove Y/N.


Enter 'y' to remove the jdk. After that verify jdk by running the command "java -version", you will get the following out put : bash: /usr/bin/java: No such file or directory


Install the new JDK Version

Go to the following link for how to install jdk on linux


Sunday, October 26, 2014

Oracle SOA 12c: How to create Inline Bpel Subprocess

As from my previous blog post on Getting started with resuable bpel subprocesses, you get some basic idea of resuable subprocesses in Oracle SOA 12c. Here in this blog post I am going to show you how to create a Inline bpel subprocess in your soa composite application.

Scenario:

I am creating a Error handler service in which there two scope in the Error Bpel Process. 
  • Notification scope: In this process email notification is send to the user using the notificaiton service.
  • Logs scope: In this process logs is written in the external file system using the file adapter
Note: Only the scope activity can be converted into subprocess.

Create inline bpel subprocess
  1. Create a soa project in soa application i.e. CommonComponents and in that create a bpel 2.0 process i.e. "ErrorProcess"
  2. In the bpel process, create two scope logs and Alert (notification scope). Now in the log scope call the file adapter to write the logs on to the file system and in Alert scope call the notification service to send email.
  3. Now right click on the scope and select convert to subprocess
  4. After creating subprocess, you can see the subprocess in the components tab.
  5. Drag n drop the inline subprocess where ever you required.
  6. Save, deploy and test the process.


Oracle SOA 12c: Getting started with Resuable BPEL Subprocesses

Previously if any one wants to resuse the BPEL code then one has to build a logic into the separate process and this process is called by invoke activity through webservice in another process. Well we can't say this is the problem or not, but in Oracle SOA 12c there is more efficient way to make BPEL code reusable across the process. One scenario came to my mind is in BPEL process, sometimes you have to "log the messages for monitoring", "send notification to the process owners" etc. and this can be done at multiple times in a process, so calling subprocess is better way than invoking external http service etc.

Here are some of the benefits of Subprocess:

  • Reusability of BPEL code. Now don't have to write same code multiple times, just create subprocess and call that subprocess where ever you want.
  • You don't have to change the logic at multiple times, just change in the sub process i.e. at one place only.
  • Code looks more modularized and easy to understand by any other stakeholder.
  • It is better than calling the invoke activity.
Some points needs to be remember about subprocess
  • Subprocess is only supported with BPEL 2.0
  • Correlation sets are not supported with subprocess.
  • Subprocess can not be shared between multiple composites. But you can use the soa template to shared across the multiple composite.
  • Monitor view is not supported from inside the subprocess.

Oracle SOA 12c provides support for two types of resuable subprocesses.

Standalone BPEL Subprocess:

Standalone bpel process defined in a file with extension .sbpel (subprocess bpel extension). This process is out side the parent bpel process as shown in the figure below:

Here in the subprocess you can use any activities that is use in the bpel and you can use the subprocess by connecting through dotted wire with the parent bpel process. In figure above two sub process AlertNotificationProcess and LogsProcess are wired with Error bpel process.

See this post How to create standalone process.

Inline BPEL Subprocess

Inline subprocess are defined inside the parent bpel process that means we can't call the subprocess outside the parent bpel process. This subprocess may be useful in the situation where same activity happens at multiple times in single bpel process e.g.

  • Status updating in database or calling external webservice at multiple times in process at various levels.
  • logging of message at multiple times in a process.
  • Validation of message in a process.
see the figure below:

you can see the inline process under the components tab, here the log scope has been converted into subprocess. Here the log scope is converted into in line subprocess.


Note:  Always remember only the scope activity can be converted into inline subprocess.

Oracle SOA 12c: How to create Standalone Bpel Subprocess

As from my previous blog post on Getting started with resuable bpel subprocesses, you get some basic idea of resuable subprocesses in Oracle SOA 12c. Here in this blog post I am going to show you how to create a standalone bpel subprocess in your soa composite application.

Scenario:

I am creating a Error handler service in which there two subprocess 
  • AlerNotificationProcess: In this process email notification is send to the user using the notificaiton service.
  • LogsProcess: In this process logs is written in the external file system using the file adapter
  • Error Process: This is a parent process which is calling both the above process. 
  • Finally this process is exposing the soap webservice which is called by external client.
Note: In similar way you can create more bpel process and you can use the subprocess in each of your bpel process if required.

Create standalone bpel process
  1. Create a soa project in soa application i.e. CommonComponents and in that create a bpel 2.0 process i.e. "ErrorProcess".
  2. Now drag n drop the subprocess from the components tab and create two sub processes i.e. "AlertNotificationProcess" and "LogsProcess". 
  3. Now implement the logic one by one in subprocess,
  4. In the AlertNotificaitonProcess, just drag and drop the email notification activity and configure it. 
  5. Similary in the LogsProcess, Just drag and drop the file adapter and configure it.
  6. Now in the parent process just drag and drop these subprocesses to call  where ever required.
  7. Map the parameters.
  8. Save, deploy and test the project.

Sunday, October 12, 2014

Oracle OSB 12c: Pipeline templates in Oracle Service Bus 12c

One of the best thing for any developer is to write a code which can be used as many times in an enterprise application. Pipeline templates is one of such capability in Oracle Service Bus in which developer create a prototype of a  pipeline called as pipeline template and include all the component which can be use across the enterprise services. One such example can be a Error handler.

Here in this post I will try to explain and give an idea of how one can use the pipeline templates in its Oracle Service Bus application. I am going to create template in which I will include these components:

  • Validation
  • Error Handler
  • Logging
  • Alerts
  • Reports
As you can see these are the common components which can be used across all the Services in OSB.
Let me start with the basic.

Pipeline:

Pipeline component in OSB provides message processing capability i.e. defines logic for routing, validation, manipulation of messages (transformation) or error handling etc.
Primary elements for Pipeline are:
  • Start Node: It is a by default node define automatically when you connect to proxy service.
  • Pipeline Pair: node for request & response pair processing.
  • Branch Node: node to route the message based on condition either on type of operation or values.
  • Route Node: this node set the destination of message otherwise by default echo the request i.e. request is passed to the response.
  • Error Handler: handle errors either on stage or node.

Note: Minimum start node and route node required for pipeline.

Pipeline Template:

A template in pipeline is a prototype of message flow for proxy services. It defines the reusable activities that are common across the business process for example validations on business messages, error handling, transformation of request and response messages etc.

How to create pipeline templates in Jdeveloper

1.       Right click on the projectà NewàPipeline_Template
2.       Template wizard appears, Enter all the information.
3.       Click Next to select service type.
4.       Finish.
5.       Now in the pipeline template add the route node, error handler or any logic which is common across the service. (follow the example)

Note: you cannot create pipeline templates in OSB console.

Pipeline Template Example

Code Structure
  • Two projects i.e. SharedSB and ConsumeTemplate.
  • SharedSB is project in which we store all the common resources that can be used in all the service bus application and In ConsumeTemplate I will create a pipeline on the basis of pipeline template.

Create Pipeline Template (CommonComponent.ptx)
  1. Create pipeline template CommonComponent.ptx

  2. Drag and drop all the components that you think can be re-used in many services. In this case I am using Validity, Error handler, reports, logging, Alerts.
  3. After configuring all the activities, you can lock the activities so that the same configuration can be used in all the concrete pipeline i.e. in the pipeline where you are importing the pipleline template.

Creating concrete pipeline using template
  1. Create proxy service.
  2. Create pipleline using the template and use same signature as of your proxy service.
  3. After importing template, implement message flow logic if required.
  4. Save and deploy both the projects SharedSB and ConsumeTemplate on Oracle Service Bus server.
  5. Test your application.
References:

  • http://docs.oracle.com/middleware/1213/osb/develop/title.htm#BEGIN

Oracle OSB 12c: Break the pipeline template link from the concrete pipeline

In Oracle Service Bus if template that you use to create a concrete pipeline is no longer required than there is an option to break the link between the template and concrete pipeline. But remember this is a irreversible action so you can't go back and link again the template and concrete pipeline.

Here are the steps:

  1. Open the configuration of concrete pipeline.
  2. In the configuration of template, click on the break button as shown below.
  3. Click yes.
  4. Now concrete pipeline is converted into regular pipeline.
Note: As this is an irreversible action so please think before doing it whether it is required or not.