The Faspex Client SDK for Java enables your application to easily interact with Faspex services; it provides simple to use setup for utilizing the faspex REST API and creating FASP transfers. You can quickly learn more about the faspex Client SDK by watching the introduction video. This document contains examples of different services you can make as well as the full API Documentation for your reference. To get started you will need to download the Java SDK using the Download option below.
This example shows how to build and send a faspex package. It also shows how to configure the ExecutorService that will be shared among the instances of faspex Client. Depending on your needs you can extend this example to include a Thread Pool or other threading strategy. In the example below the send() method is a non-blocking call since it only returns a basic implementation of java.util.concurrent.Future<DeliveryId>. If you call waitForTransferToFinish() on the result it will force the execution thread to wait until the operation is finished and the result is returned. Essentially by doing this you make the send() method a blocking call so you can ensure the operation finished and perform any post handling appropriately.
This example shows how the faspex listener extends the AbstractFaspexListener class and how by doing so it is able to intercept the various faspex Events and act upon a specified event if the
This example shows how to set a custom preprocessor that allows pre-transfer tasks to be performed on the item. These tasks can be passive or change the item by modifying the file or any other aspect. For example, the preprocessing task could encrypt the files before they are sent, which would change the filename or path. The example below simply builds on the Send example by registering the preprocessor and including the metadata items that will be used by the preprocessor. The new lines are surrounded by "////////////" to demarcate them from established content.
This example shows how to implement a custom preprocessor. This preprocessor is given access to the faspex Listener located in the faspex Client. This is used to send regular or custom events back to your application. In the case of custom events, additional code may need needed to unpack the item's content. Preprocessors can be passive or actually modify the item being transferred. Preprocessing phases are wrapped in between the SendStart and SendDone phases and are only triggered if the preprocessor is registered.