public interface MessageHandler
|Modifier and Type||Method and Description|
Called by the framework after each handleMessage() call to allow the handler to release any resources.
Gives the handler a message and context to operate on.
boolean handleMessage(MessageContext context) throws com.digev.fw.exception.GException, MessageFaultException
Gives the handler a message and context to operate on. By returning true, the handler is indicating to the messaging engine that the it should continue the normal messaging flow, including the possible calling of other handlers in a chain.
By returning false, the handler is indicating to the messaging engine that the messaging flow should stop. When the handler is in the Provider role of an exchange, returning false indicates that the messaging engine should immediately respond to the Consumer with the current content of the containing exchange's out or fault message (depending on which exists). In other words it is the responsibility of the handler that returns false to ensure that an out or fault message is correctly set on the exchange that contained the in message.
If the handler throws an exception, the messaging engine will create a fault with the content of the exception and return that to the consumer. Any handlers in the Provider role of an exchange will then be invoked with the newly created fault to perform any necessary fault processing.
When the handler is in the Consumer role of an exchange, returning false just stops the message from being delivered. If the consumer is to be alerted as to why the message would not be delivered, the handler should throw an exception instead.
context- MessageContext holding the message and other information pertinent to the processing of the message, possibly provided by previously called handlers if invoked from a chain.
com.digev.fw.exception.GException- Thrown if the handler encounters an error that does not allow it to server its purpose. If the handler is in the Provider role, the content of the exception will be returned to the consumer in a fault. If the handler is in the Consumer role, the exception is reported to the caller.
MessageFaultException- Thrown if the handler detects a condition in the message that warrants the current handler processing to stop and a fault be returned. This is different than throwing a GException whereby the handler is able to complete its duties but it has detected a problem with the message (a policy violation for example).
void close(MessageContext context) throws com.digev.fw.exception.GException
context- MessageContext from the previous handler invocation.
com.digev.fw.exception.GException- Thrown if an error occurs that should prevent any other handlers to be closed.
Rogue Wave, Inc. Copyright (C) 2000-2019, All rights reserved
This software is the confidential and proprietary information of Rogue Wave, Inc. and is subject to copyright protection under laws of the United States of America and other countries. The use of this software should be in accordance with the license agreement terms you entered into with Rogue Wave, Inc.