Inbound event processing is an asynchronous operation. The adapter
polls the FTP server, pulls events from the FTP server, converts the information
into business objects, and sends the business objects to the configured endpoint.
The adapter polls files from the event directory of the FTP server
at regular intervals based on the FTPPollFrequency property. When an file
arrives in the event directory, the adapter reads the entire file and downloads
the file to a local event directory on the adapter server. After the file
is downloaded, the adapter either archives the file in the FTP sever in an
archive directory given by the FTPArchiveDirectory property or deletes it
based on your configuration. The event directory, archive directory, the poll
interval, and the poll quantity (the number of files to poll in a single poll
cycle) are all configurable parameters.
After the business objects are
successfully posted to the endpoint, the events are either archived in an
archive directory on the local file system or deleted, based on your configuration.
The adapter must archive or delete the events or they will be polled again.
The
adapter sends the business object to the endpoint via a function selector,
which selects an operation to invoke on the component, and a data binding.
Inbound
event processing consists of the following steps:
- FTP server generates events in the form of files.
- The FTP adapter polls the files from the event directory.
- The files are fully downloaded to the adapter server.
- The files are split based on the SplittingFunctionClassName and SplitCriteria
properties.
- If splitting needs to be done based on a delimiter, the class that performs
this functionality and the split criteria are provided.
- If splitting needs to be done based on file size, the class name that
performs this functionality is provided.
You can implement a custom class containing the splitting logic. The
adapter provides a Java™ interface for the class. The details
of the interface are shown below.
public interface SplittingFunctionalityInterface extends Iterator{
public int getTotalBOs(String filename) throws SplittingException;
public void setBODetails(String filename, int currentPosition, int totalBOs,
boolean includeEndBODelimiter) throws SplittingException;
public void setSplitCriteria(String splitCriteria);
public void setEncoding(String encoding);
public void setLogUtils(LogUtils logUtils);
public boolean isSplitBySize()
}
- public int getTotalBOs(String filename) throws SplittingException
This
method returns the total number of business object’s present in the event
file given by filename.
- public void setSplitCriteria(String splitCriteria)
This
method takes the splitCriteria, which is based on the number
of business object’s in the event file. Each business object is returned during
the next() call.
- public void setLogUtils(LogUtils logUtils)
This method
is used to set the LogUtils object, which is the class that
the user can use to write trace and log messages to the files.
- public void setEncoding(String encoding)
This method
is used to set the encoding of the event file content. This encoding is used
while reading the file content. This encoding is also used for the SplitCriteria.
- public void setBODetails(String filename, int currentPosition,
int totalBOs, boolean includeEndBODelimiter) throws SplittingException
This
method is used to set the current business object number so that whenever
a next() call is made, the business object number set in
the currentPosition is returned. It also takes an includeEndBODelimiter parameter,
which when set to true, includes the SplitCriteria at the
end of the business object content. This method must be called before every next() call
so that the next() method returns the business object content
for the business object set in this method.
- The iterator has 3 methods: hasNext(), next and remove(),
which also need to be implemented. The next() method returns
the business object content for the business object position set in setBODetails().
If the business object position is not set, it fails. The hasNext() method
indicates whether the business object position set in the setBODetails() exists
or not. Before a hasNext() call, the setBODetails() method
must be called. The remove() method is called for each of
the business object entries being deleted from the EventPersistence table.
Do not delete the event file in this method. Only clean up resources that
are being used.
- public boolean isSplitBySize()
This method indicates
whether the event file is parsed based on size or based on delimiter.
- The adapter sends the business object to the endpoint through a function
selector, where the configured data binding is invoked, converting the text
record into a business object. The business object is sent to the endpoint.