15
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | OSB Exception Handling & Logging Joey Wong Solution Architect Oracle Sydney

OSB Exception Handling Logging - OFM Canberra September 2014

  • Upload
    joelith

  • View
    93

  • Download
    1

Embed Size (px)

DESCRIPTION

Slides from the OSB Exception Handling and Logging presentation held at the OFM Canberra Middleware Forum September 2014. For more information please see ofmcanberra.wordpress.com

Citation preview

Page 1: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

OSB Exception Handling & Logging

Joey WongSolution ArchitectOracle Sydney

Page 2: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Exceptions

Page 3: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Exception HandlersFour types of error handlers:

• Stage

• Pipeline

• Route

• Service

Page 4: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Guidelines• Easier to handle specific errors at lowest

level.

• Handle more general default processing of errors using higher level error handlers.

• Good practice to explicitly handle anticipated errors in pipeline.

• Allow service-level handler to manage unanticipated errors.

Page 5: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Stage Error Handler• Use dedicated stage for each specific part

of the message flow.

• Allows very specific types of errors to be caught.

• Enables greater level of control over error processing.

Page 6: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Pipeline Error Handler• Sites above the stage error handlers.

• Exceptions re-thrown in a stage error handler will be propagated to the pipeline error handler.

• Request pipeline error handler is typically the result of malformed incoming request messages of bug in the request path.

Page 7: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Route Error Handler• Most errors seen by OSB happen here.

• Error handler is responsible for putting the fault message back into the SOAP body and forwarding the fault to the response message flow.

• Error message should be logged/alerted.

Page 8: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Service Error Handler• Always account for unanticipated errors.

• Enables unhandled exceptions at the stage, pipeline or route level to be caught and handled.

• Should be used for unanticipated errors.

• Bad practice to use this error handler to process all errors.

Page 9: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Common Error Handler• Depending on the type of exceptions that can be caught, you may find error handling

code is duplicated.

• May be more efficient to write a common error handling service.

Page 10: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Error Behavior• Errors are handled differently depending on how the service is called.

• Do you want to roll the transaction back for an asynchronous proxy?

• Do you want to send a fault back in response for a synchronous proxy?

Page 11: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Synchronous Errors• Synchronous transports like HTTP must

contain “Reply - With Failure” action.

• This send the fault back in the response to the consumer.

• Message flow terminates, no additional actions or error handlers will be executed.

Page 12: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Asynchronous Errors• Asynchronous transports like JMS must

contain “Raise Error” action.

• Similar to a rethrow in Java, causing the transaction to be rolled back.

• Raise Error action will be caught by a higher level error handler.

Page 13: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Logging

Page 14: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Logging Types• Log

• Alerts

• Report

<Sept 24, 2014 2:08:33 PM PDT> <Error> <OSB Logging> <Oracle-000000><[PipelinePairNode1, PipelinePairNode1_request, show text info, REQUEST]Text contents are: This is the file a.txt END><Sept 24, 2014 2:08:33 PM PDT> <Error> <OSB Logging> <Oracle-000000><[PipelinePairNode1, PipelinePairNode1_request, show text info, REQUEST]File name is: ftp_in/a.txt><Sept 24, 2014 2:08:33 PM PDT> <Error> <OSB Logging> <Oracle-000000><[PipelinePairNode1, PipelinePairNode1_request, show text info, REQUEST]Text contents are: This is the file b.txt END><Sept 24, 2014 2:08:33 PM PDT> <Error> <OSB Logging> <Oracle-000000>< [PipelinePairNode1, PipelinePairNode1_request, show text info, REQUEST]File name is: ftp_in/b.txt>

Page 15: OSB Exception Handling Logging - OFM Canberra September 2014

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Guidelines• Establish logging requirements before starting development.

• Logging usually doesn’t need to include the entire body of the payload.

• Set appropriate logging levels.

• Error handlers should log at level “Error”.

• Dedicated OSB log file.

• Reporting action is heavy on resources. Use sparingly for Audit purposes.