Monday, May 30, 2011

Synchronous Read in File adapter

I was trying to get a good explanation for synchronous read file operation in soa suite but couldn't get one.Here in this exercise i will try to explain the synchronous read operation of file Adapter.


A bit is mentioned in the Oracle document

It says

In the outbound direction, the Oracle File Adapter polls and reads the current contents of files. This section provides an overview of the outbound synchronous file reading capabilities of the Oracle File Adapter. For reading a file synchronously, you select Synchronous Read File operation.

I have tried several scenario to make it clear what exactly is synchronous read.

I created a simple bpel process

It will start with polling a file directory using read file operation and will invoke a process.


This was working as expected.


Then I thought of creating another process where in i will use synchread for polling but i was surprised that as soon as i finished the configuration the file adapter moved to external reference side as shown ,and i was expecting it should come in exposed service side.




So the first thing that i learned is the Synchronous read operation is an outbound operation and is not used for polling a folder to initiate a process.
So from this we can just get the idea that synchronous read is used in case when we want to read a file in mid of a process.

And you need to use an invoke activity to call synchronous read opearation.
So i create a simple BPEL process to call this opeartion and here is what my process looks like.



Now i copied the file in the location from where file adapter is doing a synchronous read and invoked the process and it completed successfully.So i believe this explanation might have cleared your query as what is synchronous read and when it should be used.

If you do not have a file in the location then you may face some error

<bpelFault><faultType>0</faultType><remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'SynchRead' failed due to: No Data to process. No Data to process. File /refresh/home/Desktop/input/pox.txt to be processed was not found or not available or has no content Please make sure that the file exists in the specified directory. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>No Data to process. No Data to process. File /refresh/home/Desktop/input/pox.txt to be processed was not found or not available or has no content Please make sure that the file exists in the specified directory. </detail></part><part name="code"><code>null</code></part></remoteFault></bpelFault>


Exception occured when binding was invoked. Exception occured during invhttp://www.blogger.com/img/blank.gifocation of JCA binding: "JCA Binding execute of Reference operation 'SynchRead' failed due to: No Data to process. No Data to process. File /refresh/home/Desktop/input/pox.txt to be processed was not found or not available or has no content Please make sure that the file exists in the specified directory. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.

So make Sure you have the file in the location which is getting invoked.You can define your own fault handling mechanism to catch the fault.

for information on fault handling you can follow the following link

3 comments:

happygoing.nic said...

Good explanation. Thanks.

Anonymous said...

Thank you for the explanation. Now I finally understand why Oracle names this operation Synchronous read.
Gerrit Smink (Netherlands)

Anonymous said...

wholesale nfl jerseys from china 26636