Developing StreamBase Embedded Adapters

An embedded adapter is a StreamBase component, inserted in the flow of a StreamBase application, that calls a custom Java method. It runs in the same StreamBase Server process that is hosting and processing your StreamBase application's requests. Embedded adapters start and stop automatically with the StreamBase application, which simplifies many administration tasks, and can eliminate the client-server communication overhead seen with external adapters.

Embedded adapters extend the following packages in the StreamBase Java Client library:

  • com.streambase.sb.adapter.InputAdapter

  • com.streambase.sb.adapter.OutputAdapter

Embedded adapters inherit some behavior from operators, and both InputAdapter and OutputAdapter are subclasses of com.streambase.sb.operator.Operator.

Designing, developing, and deploying embedded adapters in StreamBase Studio is similar to working with Java operators, and follows this general process:

  1. Create the required Java class for your adapter. We strongly recommend using the StreamBase Embedded Adapter wizard to generate the base Java code, as described in the following topic:

    Using the StreamBase Embedded Adapter Wizard

  2. Edit the Java source generated by the wizard to implement your specific functionality. The code includes // TODO markers that indicate sections that need to be completed. The following topic contains information about writing adapter code:

    Creating Custom Java Embedded Adapters

    Pay special attention to the Methods for Studio Presentation section of that page.

  3. If you are using third-party JARs or native libraries, you may need to configure StreamBase Studio to correctly load the libraries:

    Using Third-Party JARs and Native Libraries

  4. Add the adapter to a StreamBase application, as described in this Authoring Guide topic:

    Using Embedded Adapters

    You can use the adapter and test it in the StreamBase Studio environment without compiling or packaging it.

  5. Deploy the adapter.

    If you are creating an adapter that you want to share with others as a global adapter, you must create a manifest, as described in Creating Manifest Files for StreamBase Adapters. Otherwise, no manifest is required.

    Deployment is described in Deploying Applications. It involves packaging your adapter into a JAR and exporting it to your file system. When you deploy your application, you will need to edit the sbd.sbconf file that will run it, defining the operator-resource-search element to identify the deployed location of your adapter JAR.