The StreamBase Java and C++ client APIs did not change in fundamental ways for 5.0. Both APIs did undergo a cleanup that resulted in changes to a few methods and classes. If you have custom StreamBase clients, operators, adapters, or monitor listeners, make the changes described on this page, if applicable in your code. Then recompile with the 5.0 libraries, and your custom code should work as expected with StreamBase 5.0 servers.
The following changes in the Java API for StreamBase 5.0 may require you to update your custom Java application code. For all changed APIs, consult the Javadoc documentation for usage details. The StreamBase API is documented in API Guide.
- Operators and Adapters
-
One new method is provided:
getPortCounts. - Data Types
-
New data types
LongandBlobare provided, with changes visible throughout the API. Most notably, classTuplehas added get and set methods forLongandBlob. - ByteArrayView and New Tuple Buffer Methods
-
The new class
ByteArrayViewcan be used to minimize copies for the String and Blob data types. See the new methods onTupleincludinggetStringBuffer,setStringBuffer,getBlobBuffer, andsetBlobBuffer. The methodssetStringBufferandsetBlobBufferwill make a copy of the passed-in data for safety. The methodsgetStringBufferandgetBlobBufferprovide copy-free access to the data, so care must be taken to avoid unwanted aliasing of these buffers. - DequeueResult
-
DequeueResulthas changed the preferred interaction model. It now implementsIterable, and that is the optimal way to interact with it. Theget(),get(index), andlist()methods have been deprecated in favor ofiterator(). In addition, thereuseTuple()method is deprecated and no longer has any effect. - Tuple
-
In addition to new methods for the
LongandBlobdata types, and new methods for copy-free data access, theTupledata type has new methodsisReadOnly()andcreateWriteableTuple(). When dequeuing from StreamBase, the resulting tuples will be read-only, which allows a more efficient representation of tuple data. If a writeable version of a tuple is required,createWritableTuplemust be called. In addition,Tuple.clone()has new guarantees about copying all potentially-shared data when cloning. This is relevant to users of the newsetBlobBufferandsetStringBufferAPI methods. - Tuple setter methods
-
In prior versions, all
Tuplesetter methods that take objects (for example,Tuple.setString()) threwIllegalArgumentExceptionif they were passed a null object. As of this release, they instead delegate to the API callsetNull(), without throwing an exception. - Schema
-
StreamBase internal-only methods for measuring the size of tuples in bytes have been removed from the
SchemaAPI. - Timestamp
-
The
Timestampclass has replacedtoSQLDatewithtoSQLTimestamp, with a more appropriate return value.
The C++ API underwent a full overhaul to make it easier to use and to ensure safety while doing so. This resulted in the following changes. See the C++ Doxygen documentation for usage details on the new and changed classes.
- New Tuple and TupleList classes
-
The classes
ConstTupleandBufferedTuplehave been replaced byTuple. Similarly,ConstTupleListandBufferedTupleListhave been replaced byTupleList.TupleandTupleListshould be used as value classes and passed around as such. They will automatically efficiently share data when possible, but can be externally treated as unique values (much the waystd::stringcan).TupleandTupleListhave an API largely the same as their older counterparts, with the following notable exceptions:-
TupleandTupleListcannot be constructed with backing arrays the wayConstTupleandConstTupleListcould. -
Tuplenow supports blobs withgetBlobBuffered()andsetBlobBuffered(). -
TupleListhas extra methods to make it act more like astd::vector<Tuple>:-
begin()andend()for iterators -
resize(),size(), andempty()for general access
-
-
The methods for determining the byte level size information of a
Tuplehave been removed fromSchema.
-
