-
Notifications
You must be signed in to change notification settings - Fork 547
Subsection for Upload Post API
The interface of streaming resource is similar to the asynchronous resources with a callback parameter that’s used to return the result.
T
@Override
public void create(@UnstructuredDataReactiveReaderParam UnstructuredDataReactiveReader reader, Callback<CreateResponse> callback) {
reader.getEntityStream().setReader(new GreetingUnstructuredDataReader(responseCallback));
}
Create Response
The standard CreateResponse represents the response of the uploading.
Reading Unstructured Data
Streaming requires the data to be read/written in continuous chunks manner. Simple bytes array or InputStream won’t do the job. Rest.li adopt the EntityStream interface. Refer to their documentation for more details.
ByteString is essentially Rest.li’s immutable bytes array implementation and is used here to represent a single chunk. Asynchronously, a number of chunks (determined by the data EntityStream) will be received by this Reader at a later time.
Reading Unstructured Data w. R2 Reader
Rest.li’s R2 layer has its own similar EntityStream implementation. If a writer is already provided, it can be easily converted to Rest.Li Writer using EntityStreamAdapters util.
Writer dataWriter = new ResumeDataWriter(id);
com.linkedin.entitystream.Writer<ByteString> dataPublisher = EntityStreamAdapters.toGenericWriterx(dataWriter);
Quick Access:
- Tutorials
- Dynamic Discovery
- Request Response API
-
Rest.li User Guide
- Rest.li Server
- Resources
- Resource Types
- Resource Methods
- Rest.li Client
- Projections
- Filters
- Wire Protocol
- Data Schemas
- Data
- Unstructured Data
- Tools
- FAQ