Developers: Managing Custom Java Operators and Embedded Adapters

Home
Documentation
Library
Sample Code and Applications
FAQs
Articles
Community
Training
Download Center
Contact DevZone

Printer Friendly

Library Articles

Managing Custom Java Operators and Embedded Adapters

Author: Michael Teixeira
Contributor: Dr. John Lifter
StreamBase Systems
26-February-2007

Applicable To: StreamBase 3.7, 5.0

 

Topics:

Introduction

Beginning with StreamBase 3.7, custom Java operators and embedded adapters (which are a subclass of Java operators) may be individually managed using the sbadmin command. The sbadmin command can be used to shutdown, restart, suspend, or resume a custom Java operator or embedded adapter. Additionally, sbadmin may be used to invoke methods on a specific instance of a custom Java operator or embedded adapter, which allows reconfiguration while an application is running.

To fully understand the syntax of each command discussed in this article, you should be familiar with the StreamBase Server container model and the format of StreamBase URIs. See the Developer Zone article The StreamBase Server Container Model.

Determining the Status of Operators and Embedded Adapters

You use the sbc status --operators [container_name] command line utility to get a listing of the operators, and their status. As shown in the following example, when issuing this command you need to provide the extended URI that identifies the container of interest.

sbc -usb://host:port/container_name status --operators [container_name]

A listing of each operator in the specified container, and its current status, will be displayed in the command window.

Suspending, Resuming, Shutting Down, and Restarting Operators and Embedded Adapters

The following commands are available for managing Java operators and embedded adapters. If you do not specify an extended format URI, you will need to supply the fully qualified name for the operator. For example, the commands in each pairing are equivalent.

sbadmin -usb://host:port/container_name suspend operator_name [...]
sbadmin suspend container_name.operator_name [...]

sbadmin -usb://host:port/container_name resume operator_name [...]
sbadmin resume container_name.operator_name [...]

sbadmin -usb://host:port/container_name shutdown operator_name [...]
sbadmin shutdown container_name.operator_name [...]

sbadmin -usb://host:port/container_name restart operator_name [...]
sbadmin restart container_name.operator_name [...]

Note that the name (or fully qualified name) assigned to the Java operator or embedded adapter is used to direct the action to the object.

Changing the Configuration of an Operator or Embedded Adapter

To determine what configuration properties can be changed on a Java operator or embedded adapter use one of the following commands.

sbadmin -usb://localhost:port/container_name getOperatorProperties operator_name
sbadmin getOperatorProperties container_name.operator_name

This command will return a list of configurable properties and their current values. For example, for a CSV file reader embedded adapter named InputAdapter1, running in an application deployed into a container named A, this command would return information similar to the following.

sbadmin getOperatorProperties A.InputAdapter1
    File Name : people.csv
    Repeat : 1
    Field Delimiter : ,
    Schema : schema:InputAdapter1
    String Quote Character : "
    Timestamp Format : MM/dd/yyyy
    Period : 0

If you know the name of the property whose current value you want to review, enter one of the following commands.

sbadmin -usb://localhost:port/container_name getOperatorProperty 
operator_name property_name sbadmin getOperatorProperty container_name.operator_name property_name

If the property name includes a space, you must enclose the property name within quotation marks.

sbadmin getOperatorProperty A.InputStream1 "File Name"

Once you select a property to modify, use one of the following variants of the sbadmin command to change the property value.

sbadmin -usb://host:port/container_name setOperatorProperty operator_name
property_name property_value sbadmin setOperatorProperty container_name.operator_name property_name
property_value

For example:

sbadmin setOperatorProperty A.InputAdapter1 "File Name" morepeople.csv
sbadmin setOperatorProperty A.InputAdapter1 "Field Delimiter" ;
sbadmin setOperatorProperty A.InputAdapter1  Repeat 3

As shown, if the property name includes a space, you must enclose the property name within quotation marks.

Depending on how the operator or embedded adapter is implemented, you may be able to modify properties while the component is running, in the suspended state, or stopped. For example, the CSV file reader and writer embedded adapters only load their configuration information on startup, so to reconfigure these adapters you must shut them down, change the configuration, and restart. Other operators or embedded adapters may permit reconfiguration while they are running.

Related Topics

  • Using sbadmin to manage the StreamBase container model is described in The StreamBase Server Container Model.
  • New in StreamBase 5.0, the graphical StreamBase Manager component can be used to create, control, and manage containers. See the product documentation for additional information on StreamBase manager

Back to Top ^