Class AbstractInboundProcessor
java.lang.Object
com.onenetwork.platform.integ.msg.AbstractInboundProcessor
- All Implemented Interfaces:
InboundProcessor
public abstract class AbstractInboundProcessor extends java.lang.Object implements InboundProcessor
Simplified base class for implementing
InboundProcessor
.
You should implement only processMessage(Message, GridTaskContext, File, PlatformUserContext)
to create your processor.-
Constructor Summary
Constructors Constructor Description AbstractInboundProcessor()
-
Method Summary
Modifier and Type Method Description static void
createNeoNotification(java.lang.String fileName, boolean hasErrors, PlatformUserContext userCtx)
static java.io.File
getErrorsFile(Message msg)
Deprecated.UsegetErrorsResource(Message)
to get error storage resource which is independent of storage repositorystatic SharedStorageServiceResource
getErrorsResource(Message msg)
void
handleResults(TaskResult result, Message msg, PlatformUserContext ctx)
After processing, handles success and error cases, typically by enqueueing a response message.TaskResult
process(Message msg, GridTaskContext gridCtx, PlatformUserContext ctx)
Callback from the message queue framework to process an inbound message.abstract void
processMessage(Message msg, GridTaskContext gridCtx, java.io.File fileForErrors, PlatformUserContext ctx)
Implement this method to process your Message.
-
Constructor Details
-
AbstractInboundProcessor
public AbstractInboundProcessor()
-
-
Method Details
-
processMessage
public abstract void processMessage(Message msg, GridTaskContext gridCtx, java.io.File fileForErrors, PlatformUserContext ctx) throws java.lang.ExceptionImplement this method to process your Message. You should read the content of the Message viaMessage.readPayload()
, and denote any errors in the File denoted by fileForErrors. A suitable success or error Message will be enqueued to an "outbox" based on whether you recorded anything in fileForErrors or not.- Parameters:
msg
- Message to be processedgridCtx
- context of the GridTask which causedfileForErrors
- if there are any processing errors, capture them in this filectx
- processing context- Throws:
java.lang.Exception
-
process
public TaskResult process(Message msg, GridTaskContext gridCtx, PlatformUserContext ctx) throws java.lang.ExceptionDescription copied from interface:InboundProcessor
Callback from the message queue framework to process an inbound message.- Specified by:
process
in interfaceInboundProcessor
- Parameters:
msg
- Message which needs to be processedgridCtx
- GridTaskContext provides information about the grid task associated with the messagectx
- value chain admin context for the queue's parent value chain- Returns:
- TaskResult indicates whether processing succeeded or failed, and whether to retry
- Throws:
java.lang.Exception
-
getErrorsFile
Deprecated.UsegetErrorsResource(Message)
to get error storage resource which is independent of storage repositoryReturns the path used to store an error file for this processor for the given Message -
getErrorsResource
-
handleResults
public void handleResults(TaskResult result, Message msg, PlatformUserContext ctx) throws java.lang.ExceptionDescription copied from interface:InboundProcessor
After processing, handles success and error cases, typically by enqueueing a response message. The general contract for Platform's supported processors is:
If TaskResult is SUCCEED and there are no upload errors, empty success message will be enqueued to success queue If TaskResult is SUCCEED or FAILD and there are upload errors (.results file is not empty), error message will be enqueued to error queue with payloadRef pointing to error file For scenarios where extra handling is required on errors before enqueueing, override this method in the implementation class- Specified by:
handleResults
in interfaceInboundProcessor
- Parameters:
result
- TaskResult task result fromInboundProcessor.process(Message, GridTaskContext, PlatformUserContext)
msg
- Processed Messagectx
- value chain admin context for the queue's parent value chain- Throws:
java.lang.Exception
-
createNeoNotification
public static void createNeoNotification(java.lang.String fileName, boolean hasErrors, PlatformUserContext userCtx)
-