The most common reason why you’d use Java to create your application is if you have existing Java code or libraries that you would like to use in your Streams application.¬† You can write a primitive Java operator that is invoked in your SPL composite or create your entire Streams application using only Java by using the Java Application API, or using the Apache Beam SDK.
If you are new to Streams and have not done so already, I recommend you read, at a minimum, the Basic Building Blocks section in the Streams Quick Start Guide to understand how Streams applications work. ¬†For a deeper dive into Streams, you can also take the Streams course.
Then, pick the option that best suites your needs.
Options for using Java with Streams
Option 1: Create a Java primitive operator¬†
Choose this option if you want to create Java primitive operators that can be invoked from a SPL composite.
Option 2: Create Streams applications using only Java and/or Apache Beam.
If you want to create your applications using only Java, you have 2 choices:
- Use the Streams Java API to create your Streams application.
- Use the Apache Beam SDK¬†to create your application. Then use the Streams Runner for Apache Beam to deploy the application to a Streams instance.¬† While only a subset of the full Streams functionality is available, the Apache Beam API allows you to write an application that can be executed on other analytics platforms.
Developing Java primitive operators
Streams Studio, the IDE for Streams, makes creating a Java operator very easy.¬† See how it is done in 1 minute in the following video:
Using the operator is also fairly simple, as shown in this next video:
There are several more videos in this series, see the Java Operator development guide for detailed information.
- Learn how to use Java annotations to develop Java Primitive Operators: Simplified Java Operator Development
- API Reference
Debug and Performance for Java Operators
- Prevent data loss in your Java operator: add a consistent region by following this guide
- Performance Tuning with Java Operators: Performance Tuning Tips for Java Operators
Debugging a Java Operator: How to debug Java operators using the Eclipse Java Debugger?
Developing Streams applications using only Java
The streamsx.topology project on Github includes the Java Application API that allows you to create Streams applications using only Java. The advantage of this is that you do not have to learn SPL!¬† The toolkit is included in Streams but you can download the latest release from GitHub.
- Learn more by following the developer guide:
- Tips on using Java 8 with the Java Application API
- Javadoc for the API and its samples.
- streamsx.topology project on Github
The streamsx.topology project includes samples that demonstrate how to perform common tasks.¬† These samples are included in the toolkit.
- Find a sample in the Samples Catalog
- Ask a question on the forums or StackOverflow
- Articles on Streamsdev tagged “Java”