Creating a work data set
You must implement your own class that encapsulates knowledge about a work data set, which represents the set of all data found in this polling interval. The work data set is created by your implementation of the Inbound.findWork method. For example, an inbound file integration creates a work data set representing a list of all new files in an incoming directory.
Create a class that implements the gw.api.integration.inbound.work.WorkDataSet interface. Your class
must implement the following methods.
getData- Get the next work item and move any iterator that you maintain forward one item so that the next call
returns the next item after this one. Return a WorkData object if there are more items to
process. Return
nullto indicate no more items. For example, an inbound file integration might return the next item in a list of files. TheWorkDatainterface is a marker interface, so it has no methods. Write your own implementation of a class that implements this interface. Add any object variables necessary to store information to represent one work item. It is the WorkDataSet.getData method that is responsible for instantiating the appropriate class that you write and populating any appropriate data fields. For example, for an inbound file integration, oneWorkDataitem might represent one new file to process.In a Gosu implementation, the getData method appears as a getter for the
Dataproperty, not a method. hasNext- Return
trueif there are any unprocessed items, otherwise returnfalse. In other words, if this same object’s getData method would return a non-null value if called immediately, returntrue. getContext- Your implementation of a work data set can optionally declare a resource or other context necessary to
process the data item. You are responsible for populating this context information if you need it. For
example, if your inbound integration listens to a message queue, store the connection or queue information in
an instance of a class that you write that implements
gw.api.integration.inbound.WorkContext. In yourWorkSetProcessorimplementation, you can access this connection information from the WorkSetProcessor object’s process method when processing each new message.In a Gosu implementation, the getContext method appears as a getter for the
Contextproperty, not a method. close- Close and release any resources acquired by your work data set.
If your plugin supports transactional work items, your class must implement the interface
gw.api.integration.inbound.work.TxContext, which requires two additional methods.
isRollback- Returns a
booleanvalue that indicates the transaction will be rolled back.In a Gosu implementation, the isRollback method appears as a getter for the
Rollbackproperty, not a method. setRollbackOnly- Set your own
booleanvalue to indicate that a rollback will occur.
