Creating an Offloading Target
The OffloadTarget needs to accept HTTP POSTs. If coded in .NET, it would typically be a WebApi application.
The DLL provided by the SDK is named Tachyon.SDK.Offloading.dll. After referencing the DLL from the WebApi project and importing the Tachyon.SDK.Offloading namespace, an action method that receives the posts can be as short as this:
The most important line is:
- ResponseRaw - defined in the SDK DLL encapsulating raw responses offloaded from Tachyon
- JsonResponseDeserializer.DeserializeObject - converts bytes received into raw responses, and handles decompression as required
- [CustomBody] - captures raw posted data so it can be passed into DeserializeObject for decompression
For an explanation of why [CustomBody] is needed and why the default WebApi binding won't work as expected, read:
Accepting Raw Request Body Content with ASP.NET Web API - https://weblog.west-wind.com/posts/2013/Dec/13/Accepting-Raw-Request-Body-Content-with-ASPNET-Web-API.
In the above example, the method ProcessResponses would contain the custom code that processes the data received from Tachyon.
The Tachyon Server code repository contains a sample project that consumes the SDK DLL. It's calledvTachyon.Server.OffloadingClient and is located under the Tools folder.