Monday, 30 December 2013

Rejected messages in a jca DB polling adapter

I am writing this post as it may help others who have missed the oracle documentation on rejection handlers.
Whenever a polling inbound adapter (DBAdapter,File Adapter) fails after a specified number of retires the message is then moved to the specified rejection handler. The message can be later handled according to the business requirement.

Rejection Handler:
The rejection handlers can be a
  • Web Service Handler
  • Custom Java Handler
  • JMS Queue
  • File (Default)

    The rejected messages can be viewed by two ways
    • Querying the DEV_SOA_INFRA 
    select * from rejected_message
    • Looking at the console for rejected messages
    You can view the rejected messages in the Recent Faults and Rejected Messages section of the Dashboard tab or in the Faults and Rejected Messages tab.

By default if  a rejection handler is not configured a file-based rejection handler kicks in.
The messages are found at the below locations based on BPEL/OSB being used
  • FOR OSB <domain_home>/jca/receive/rejectedMessages.
  • For bpel the path is <domain_home>/rejmsgs/<wls_server_name>/<composite_name>
If it is a clustered environment you can find the folders at all managed servers path(Physical file path) .Rejected messages are stored in the database (specifically, in the rejected_message table) by default. Currently, the Oracle SOA suite does not provide the capability to resubmit rejected messages; consequently it is your responsibility to take care of the resubmission

 

Configuring rejection handler in BPEL

This is a sample faultpolicies.xml which can be used to configure the rejection handler folder in BPEL process. For more information on fault handling in bpel refer to other blog posts

 

Configuring rejection handler in OSB

If you want to configure rejected message folder in OSB use the "rejectedMessageHandlers" property as dynamic endpoint property in the jca transport as shown below
Please note that you can only configure directory in osb and configuring file name is not available .
These are the following steps
  1. Navigate to the inbound proxy service that does the polling
  2. Select the jca transport tab

  3. Scroll down to dynamic end point properties

  4. Enter property name rejectedMessageHandlers and value as file://<dirpath> (The dirpath should be the path on the server)



  5. Click + symbol on the actions tab and deploy it to the server
Now you should be able to see the rejected messages in the directory specified if they get rejected.