API Changes in StreamBase 5.0

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.

Java API Changes in StreamBase 5.0

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 Long and Blob are provided, with changes visible throughout the API. Most notably, class Tuple has added get and set methods for Long and Blob.

ByteArrayView and New Tuple Buffer Methods

The new class ByteArrayView can be used to minimize copies for the String and Blob data types. See the new methods on Tuple including getStringBuffer, setStringBuffer, getBlobBuffer, and setBlobBuffer. The methods setStringBuffer and setBlobBuffer will make a copy of the passed-in data for safety. The methods getStringBuffer and getBlobBuffer provide copy-free access to the data, so care must be taken to avoid unwanted aliasing of these buffers.

DequeueResult

DequeueResult has changed the preferred interaction model. It now implements Iterable, and that is the optimal way to interact with it. The get(), get(index), and list() methods have been deprecated in favor of iterator(). In addition, the reuseTuple() method is deprecated and no longer has any effect.

Tuple

In addition to new methods for the Long and Blob data types, and new methods for copy-free data access, the Tuple data type has new methods isReadOnly() and createWriteableTuple(). 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, createWritableTuple must be called. In addition, Tuple.clone() has new guarantees about copying all potentially-shared data when cloning. This is relevant to users of the new setBlobBuffer and setStringBuffer API methods.

Tuple setter methods

In prior versions, all Tuple setter methods that take objects (for example, Tuple.setString()) threw IllegalArgumentException if they were passed a null object. As of this release, they instead delegate to the API call setNull(), without throwing an exception.

Schema

StreamBase internal-only methods for measuring the size of tuples in bytes have been removed from the Schema API.

Timestamp

The Timestamp class has replaced toSQLDate with toSQLTimestamp, with a more appropriate return value.

Back to Top ^

C++ API Changes in StreamBase 5.0

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 ConstTuple and BufferedTuple have been replaced by Tuple. Similarly, ConstTupleList and BufferedTupleList have been replaced by TupleList.

Tuple and TupleList should 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 way std::string can). Tuple and TupleList have an API largely the same as their older counterparts, with the following notable exceptions:

  • Tuple and TupleList cannot be constructed with backing arrays the way ConstTuple and ConstTupleList could.

  • Tuple now supports blobs with getBlobBuffered() and setBlobBuffered().

  • TupleList has extra methods to make it act more like a std::vector<Tuple>:

    • begin() and end() for iterators

    • resize(), size(), and empty() for general access

  • The methods for determining the byte level size information of a Tuple have been removed from Schema.

Back to Top ^