Tuesday, November 8, 2011

JCA File Adapter and Error files

Oracle implementation of the File Adapter is the class:
oracle.tip.adapter.file.inbound.FileActivationSpec

you customize the adapter in the .JCA file

One of its parameters is

PhysicalErrorArchiveDirectory

and it is documented here

For instance if you submit an empty file, the File Adapter will fail and move the file to the Error directory. In the logs I find:


<Warning> <JCA_FRAMEWORK_AND_ADAPTER> <BEA-000000> <onReject: The resource adapter 'File Adapter' requested handling of a malformed inbound message. However, the following activation property has not been defined: 'rejectedMessageHandlers'. Please define it and redeploy. Will use the default Rejection Directory file://jca\Read\rejectedMessages for now.>

<Warning> <JCA_FRAMEWORK_AND_ADAPTER> <BEA-000000> <onReject: Sending invalid inbound message to Rejection Handler: >


In case of error in the Proxy Service consuming the message, at proxy level you should set jca.retry.count and jca.retry.interval

<jca:endpoint-properties>
<jca:endpoint-property>
<jca:name>jca.retry.count</jca:name>
<jca:value>3</jca:value>
</jca:endpoint-property>
<jca:endpoint-property>
<jca:name>jca.retry.interval</jca:name>
<jca:value>40</jca:value>
</jca:endpoint-property>
</jca:endpoint-properties>

with these settings, you will see these messages:

Failed to send message {C:\acme\ffmw\po\in\po000000002.dat} to Adapter Framework due to Retriable Exception, the worker will sleep for the configured retryInterval[40000] msecs

Retry Interval will be bounded to [30000] msecs since we're using a global processor thread pool and the current retryInterval is[40000] msecs

Since Retry Interval is specified, the processor will disable for[30000] msecs to throttle


40 seconds after, you get:

The adapter will not process [C:\acme\ffmw\po\in\po000000002.dat] since it has been processed earlier

onReject: Sending invalid inbound message to Rejection Handler:

Handing rejected message to DEFAULT rejection handler: file://jca\Read\rejectedMessages since none of the configured rejection handlers [] succeeded.

Copying file :C:\acme\ffmw\po\in\po000000002.dat to user-defined archive directory for files with errors :C:\acme\ffmw\po\error

The adapter has handled the poisoned file [C:\acme\ffmw\po\in\po000000002.dat]




So, only if you set the retry count the file will eventually be moved to the error directory also on "application" error triggered by the Proxy Service.

No comments: