Monday, 7 March 2016

Create a Simple File Adapter Project it reads file and write it

File Adapter :How to create a File To File Any Text Using Mediator:

       Hi all, today i post a content  regarding to how to create File Adapter and how to read and write a file from Source directory to target directory.
        At the Starting of the Project Create two folders at any directory, (eg:ReadFileFolder, WriteFileFolder), They acts as Source Folder & Target Folder.

Open JDeveloper, Create New Project

In New Gallery Window Select SOA Project & give proper project name & click on finish

Soure Creation:

In composite window at left side at exposed references, right click and select insert button and in list select FileAdapter (or) in component window directly select FileAdapter. 
In FileAdapter Configuration Wizard window select Next button

In Service Name give proper Name.(eg: ReadFile or SelectFile) & Click on Next

In Adapters Interface Window Select "Define from operaion and schema" radio button

In Operation Types Select Read File. & click on next
In File Directories select Physical path radio button& Select Browse button Where you save your ReadFile folder or Source where you want to read Your File.

In File Filtering Window Select File Wildcards radio button, & give Proper Name in Include Files with Name Pattern(like text files &more eg; *.txt--it supports text files, or  *.*  it supports any file format )
                     In this window we define polling frequency which means after how many seconds or minutes our file adapter will poll for new files.Also, if you want your file adapter not to read all the files as they are written on the server, use the minimum file age option.Click next.

In Messages window Check Native format translation is not required(Schema is Opaque) & click on Next button and finally select finish button.


Target Creation:
In Composite Window at left hand side External Reference, Right Click & select File Adapter



In FileAdapter Configuration Wizard window select Next button

In Service Name give proper Name.(eg: WriteFile) & Click on Next,
In Adapters Interface Window Select "Define from operaion and schema" radio button


click on next. In Operation window Select Write File &click on Next
it Show you File Configuration Window Select directory physical Path & Directory location where you want to Move/copy file Target Folder. In File Naming Convention give output_%SEQ%.txt(if you want target folder text means give text or other file format)



             

In Messages window Check Native format translation is not required(Schema is Opaque) & click on Next button and finally select finish button.

After Completion of Creating source &Target Adapter, At the middle place of Composite Window, Right Click and select Mediator



It displays Creat Mediator Window


Give Proper Mediator name.
Now give connections to source File Adapter to Mediator & Mediator to Target File Adapter.


Now give Transformation From Source Adapter to Target Adapter. Double click on Mediator.



In this Mediator window Select transformation icon


it displaces Request Transformation Map, in this select Create New Mapper File & give Default Name and click on ok.


It Displaces Trasformation window, select or drag a line from opaque source element to opaque Target element.






Save the Project & deploy it

Now you copy one text file and place this text file in source folder, depending on polling Frequecy it moves from source to destination folder.



Adapters:

                         By developing a BPEL Process we need to interact with Database or to read or write a file from local system(File Adapter), or we read or write a file from existing system(FTP).For such sort of situations we used Adapters. JDeveloper as provided us with good number of Adapters, through these Adapters we can easily interact with the existing environment.
                          Once we created a Adapter, it automatically generates XML Schema, as  XML understood by all environments. Interaction between different environments become very easy.
Adapters support a robust, light-weight, highly scalable and standards-based integration framework,which enables disparate applications to communicated with each other. They are used to integrate packaged applications, legacy applications, databases, and webservices.

The Following types of technology adapters are available in JDeveloper.

  • File/FTP Adavpter
  • Database Adapter
  • Oracle Apps Adapter
  • AQ Adapter
  • MQ Adapter
  • JMS Adapter

File/FTP Adapter

The File Adapter work with Oracle BPEL Process Manager and Oracle Mediator, to interact with local File system directories.The FTP Adapters enables to configure the BPEL/Mediator, to interact with remote file system directories.The File/FTP Adapters are basically used to read , write files locally/remotely on your system/existing system.
There are mainly 4 operations in FILE adapter namely:

  • READ: It is an inbound operation that reads a file from given directory path.
  • WRITE: It is an Outbound operation to write files to a location specified under directory path.
  • SYNCHRONOUS READ: It is Outbound operation used to read a file in middle of the process. In this we can't give poling frequency.
  • LIST FILE: It is Outbound Operation to list all the files in a given directory.or it get you the list of file names, it didn't give you file content.

The file and FTP adapters can read and write the following file formats and use the adapter translator component at both design time and run time
·         XML (both XSD- and DTD-based)
·         Delimited(Contains records whose fields are delimited by a special character)
·         Fixed Length(Contains records whose fields are fixed in length)
·      Complex Type(Contains records whose fields may themselves be records having multiple delimiter types)
·         COBOL Copybook data

It can also treat file contents as an opaque object.
For inbound file, the file and FTP adapters perform the following operations 
·         Poll the file system looking for matches
·         Read and translate the file contents based on the translation logic defined at design time
·         Publish the same as an XML message
For outbound files sent from Oracle BPEL Process Manager/Mediator, the file and FTP adapters perform the following operations 
·         Receive messages from BPEL/Mediator
·         Format the XML contents as specified at design time
·         Produce output files
For inbound file and FTP adapters have parameters for the inbound directory where the input file appears, the file naming pattern and the frequency with which to poll the directory.

Database Adapter:
The Database Adapter enables to interact with standard Database/oracle Dbase/Third party Database through JDBC.
The following operations are supported in the Database adapter
  • Call a stored procedure or a function.
  • Perform a table operation which can be one of the following.
                   Insert only
                   Update Only
                   Insert or Update
                   Update
                   Select 
  • Poll for new or changed records in a table
  • Execute Custom SQL
Before connecting to a database through the database adapter, the database connection must be created and configured for that particular database using the Database Connection Wizard.

Oracle Applications Adapter:
The Oracle Application Adapter enables to interact with various interfaces of an oracle Application instance that is hosted in a given database connection.It offers support for open interface imports, and other such things that can be done in the Oracle Apps. It offers a rich set of  object invocation which includes concurrent programs, XML gateway, EDI sources, business events apart form tables, views and APIs which can be invoked even through the database adapter.

AQ(Advanced Queuing) Adapter:
           AQ is Oracle Advanced queuing  provides a flexible mechanism for bidirectional, it provides the message management functionality and asynchronous communication needed for application integration.
              AQ are an Oracle database feature, and are therefore scalable and reliable,Other features of Oracle dbase, such as backup and recovery,logging, transactional services.Multiple queues can also service a single application. AQ only interacts with database queues because it resides in database.The enqueue operation is outbound while the dequeue operation is inbound thus the AQ adapter is both the producer and consumer of the AQ messages.Specify the operation whether it is an Enqueue or Dequeue and the queue name from which the message is to be enqueued or dequeued

     (or) 

               Oracle AQ provides database-integrated message queuing functionality. It is built on top of Oracle Streams and optimizes the functions of Oracle Database so that messages can be stored persistently, propagated between queues on different computers and databases, and transmitted using Oracle Net Services, HTTP, and HTTPS. Because Oracle AQ is implemented in database tables, all operational benefits of high availability, scalability, and reliability are also applicable to queue data.

MQ: AQ is a Oracle implementation of their Queue messaging; Advanced Queueing. The same has IBM with their MQ and like others. These implemenations are specific of the Vendors.


JMS(Java Messaging System) Adapter:
         JMS resides in Application Server(Web logic). JMS can interact with database queues as well as in memory/file or queue's outside.
       The JMS API is a messaging standard that allows application components based on the Java 2 Platform, Enterprise Edition to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.


Wednesday, 2 March 2016

List of BPEL Activities 2

Flow Activity: Flow Activity enables you to specify one or more activities to be performed concurrently or parallelly. A Flow Activity completes when all activities  in the flow  have finished processing or skipped.
                      whenever you think about fixed number of branches executed parallelly use Flow activity. 

FlowN Activity: FlowN Activity used to invoke services parallel,it creates multiple flows equal to the value of n, which is defined at runtime based on the data available and  logic within the process.
                        An index variable increments each time a new branch created, until the index variable reaches the value of N. The FlowN activity is replaced by the forEach activity in BPEL 2.0 project.


Transform Activity: This activity enables you to create a transformation that maps source elements to target elements.



Java Embedding Activity: This activity enables you to add custom Java code to a BPEL process using the Java BPEL exec extension <bpelx:exec>. This is useful when you already have Java code that can perform a function, and want to use this existing code instead of starting over.



Dehydration Activity: Oracle BPEL Process manager uses the dehydration store dbase to maintain long running asynchronous processes and their current state information in dbase while they wait for asynchronous callbacks.

                   Few activities causes the BPEL instances to be dehydrated, the dehydrated activities are wait, receive, pick,reply, invoke, java embedding, call back.


Compensate Activity: Compensate activity undoes the steps of a business process that are already successfully complete. This activity can be invoked only from within a fault handler or another compensation handler. Compensation occurs when a process cannot complete several operations after already completing others. The process must return and undo the previously completed operations. 

                    For example, assume a process is designed to book a rental car, a hotel, and a flight. The process books the car and the hotel, but is unable to book a flight for the correct day. In this case, the process performs compensation by unbooking the car and the hotel.The compensation handler is invoked with the compensate activity, which names the scope on which the compensation handler is to be invoked.


Throw Activity: This Activity generates a fault from inside the business process.