Code Samples

Home/ Code Samples / Genius / Threaded Sample

Threaded Sample

The following sample demonstrates the need to use multi-threaded functionality within your POS application. When a transaction has been initiated to the Genius device, there may be times when it needs to be cancelled. Whether due to an error in the total amount or a consumer wishing to add or remove items, the cancel function can be used to cancel the transaction in progress.
Multi-threading can be achieved in many different ways depending on your code base. The following samples demonstrate the expectations when using threaded requests.

This sample uses a combination of Start Transaction, Initiate Transaction and Cancel. It will Stage a new TransportKey and initiate the transaction. After 5 seconds a Cancel request will be sent via a second thread. The application will then receive a response for both requests.
Loading Sample...
Loading Sample...