Interface SBServerManager


public interface SBServerManager
SBServerManager provides control and access to a StreamBase Engine. Obtain one via ServerManagerFactory.
Since:
6.6
  • Method Details

    • getEnqueuer

      Enqueuer getEnqueuer(String path) throws StreamBaseException
      Get the Tuple enqueue object for a stream
      Parameters:
      path - the path to the stream. If this is not a full dotted path, assumes the stream has the given name and is in the default container.
      Returns:
      Tuple enqueue object
      Throws:
      StreamBaseException - Error getting Tuple enqueue object
    • getDequeuer

      Dequeuer getDequeuer(String path) throws StreamBaseException
      Get the Tuple dequeue object for a stream
      Parameters:
      path - the path to the stream. If this is not a full dotted path, assumes the stream has the given name and is in the default container.
      Returns:
      Tuple dequeue object
      Throws:
      StreamBaseException - Error getting Tuple dequeue object
    • startServer

      void startServer() throws InterruptedException, StreamBaseException
      Start the StreamBase Engine, blocking until the StreamBase Engine will accept connections
      Throws:
      InterruptedException - Interruption
      StreamBaseException - Error starting StreamBase Engine
    • shutdownServer

      void shutdownServer() throws InterruptedException, StreamBaseException
      Shutdown the StreamBase Engine, blocking until the StreamBase Engine is finished shutting down
      Throws:
      InterruptedException - Interruption
      StreamBaseException - Error stopping StreamBase Engine
    • loadApp

      void loadApp(String fullyQualifiedModuleName) throws StreamBaseException
      Load a module into the default container. The StreamBase Engine must be started prior to his call. Note that the module container will not be started (and thus no enqueues can be made to it) until a call to startContainers() (or similar methods) is made.

      The module must specified as a fully qualified module name, for example com.tibco.sample.myModule. The module is resolved using the StreamBase Engine's class path.

      Parameters:
      fullyQualifiedModuleName - A fully qualified module name
      Throws:
      StreamBaseException - Error loading module
      Since:
      10.0 application argument must be a fully qualified module name
      See Also:
    • loadApp

      void loadApp(String fullyQualifiedModuleName, String container) throws StreamBaseException
      Load a module into the specified container. The StreamBase Engine must be started prior to his call. Note that the module container will not be started (and thus no enqueues can be made to it) until a call to startContainers() (or similar methods) is made.

      The module must specified as a fully qualified module name, for example com.tibco.sample.myModule. The module is resolved using the StreamBase Engine's class path.

      Parameters:
      fullyQualifiedModuleName - A fully qualified module name
      container - The container name
      Throws:
      StreamBaseException - Error loading module
      Since:
      10.0 application argument must be a fully qualified module name
      See Also:
    • loadAppString

      void loadAppString(String appString, String container) throws StreamBaseException
      Load an application (from a String) into the specified container. The StreamBase Engine must be started prior to his call. Note that the application container will not be started (and thus no enqueues can be made to it) until a call to startContainers() (or similar methods) is made.
      Parameters:
      appString - A string which contains the text of an application (Eventflow or SSQL).
      container - The container name
      Throws:
      StreamBaseException - on failure to load the given application
      Since:
      7.0
      See Also:
    • loadDeploy

      void loadDeploy(String deployFile) throws StreamBaseException
      Load the given StreamBase deployment file. The StreamBase Engine must be started prior to this call. Note that the application containers will not be started until a call to startContainers() (or similar methods) is made.
      Parameters:
      deployFile - Deployment file
      Throws:
      StreamBaseException - Error loading deployment file
      Since:
      7.0
    • startContainers

      void startContainers() throws StreamBaseException
      Start all the containers for this StreamBase Engine. If no stream subscriptions have yet been specified, subscribes to all streams. To avoid this behavior, and instead subscribe to no streams, use startContainers(Set, boolean) with a false argument instead.
      Throws:
      StreamBaseException - Error starting container
      See Also:
    • startContainers

      void startContainers(Set<String> containersSuspendedOnStartup) throws StreamBaseException
      Start all but the specified containers for this StreamBase Engine. If subscriptions have previously been declared using calls to subscribe(), will only subscribe to the declared subscriptions. Otherwise, if no stream subscriptions have yet been specified, subscribes to all streams. To avoid this behavior, and instead subscribe to no streams, call startContainers(containersSuspendedOnStartup, true)
      Parameters:
      containersSuspendedOnStartup - The containers to leave suspended, if null all containers will be started
      Throws:
      StreamBaseException - Error starting containers
      See Also:
    • startContainers

      void startContainers(Set<String> containersSuspendedOnStartup, boolean deferSubscriptions) throws StreamBaseException
      Start all but the specified containers for this StreamBase Engine
      Parameters:
      containersSuspendedOnStartup - The containers to leave suspended, if null all containers will be started
      deferSubscriptions - when true, no output streams will be subscribed to
      Throws:
      StreamBaseException - Error starting containers
    • subscribeAll

      void subscribeAll() throws StreamBaseException
      Subscribes to all streams
      Throws:
      StreamBaseException - Error subscribing to streams
    • subscribe

      void subscribe(String streamPath) throws StreamBaseException
      Subscribes to a stream. This method is used to pre-declare the streams you are interested in prior to calling startContainers().
      Parameters:
      streamPath - the path to the stream. If this is not a full dotted path, assumes the stream has the given name and is in the default container.
      Throws:
      StreamBaseException - Error subscribing to stream
    • stopContainers

      void stopContainers() throws StreamBaseException
      Stop all containers in this StreamBase Engine
      Throws:
      StreamBaseException - Error stopping containers
    • drain

      void drain() throws StreamBaseException
      Wait for processing to complete on all currently enqueued tuples.

      A call to this method blocks until any tuples that were already enqueued in the StreamBase Engine have run through to completion, to the best effort of the StreamBase Engine. Upon return, any tuples that have reached output streams will be available for dequeue from Dequeuer.dequeue(int).

      Note that for applications containing concurrent modules or operators, this method makes attempts to ensure it returns once all processing has completed, but does not guarantee this behavior.

      Throws:
      StreamBaseException - if an error occurs while draining; no guarantees are made about the state of pending tuples.
      Since:
      7.0.6
    • getURI

      StreamBaseURI getURI()
      return the URI of the StreamBase Engine
      Returns:
      URI of the StreamBase Engine
      Since:
      7.0
    • getTableAccessor

      TableAccessor getTableAccessor(String tablePath) throws StreamBaseException
      Return a TableAccessor suitable for manipulating this table. This may only work with embedded StreamBase Engines. Capture fields in the table will be flattened.
      Parameters:
      tablePath - Path to the table.
      Returns:
      the TableAccessor
      Throws:
      NotImplementedException - if table accessors are not supported by this StreamBase Engine implementation.
      StreamBaseException - if there is no table at that path, or if the table is inaccessible for any other reason.
      SemanticValidationException - if the table is inaccessible because of a capture field naming conflict. In that case, call with CaptureTransformStrategy.NEST
      Since:
      7.3
    • getTableAccessor

      TableAccessor getTableAccessor(String tablePath, CaptureTransformStrategy captureStrategy) throws StreamBaseException
      Return a TableAccessor suitable for manipulating this table. This may only work with embedded StreamBase Engines.
      Parameters:
      tablePath - Path to the table.
      captureStrategy - Strategy for handling any capture fields in the table, either FLATTEN or NEST.
      Returns:
      the TableAccessor
      Throws:
      NotImplementedException - if table accessors are not supported by this StreamBase Engine implementation.
      StreamBaseException - if there is no table at that path, or if the table is inaccessible for any other reason.
      SemanticValidationException - if the table is inaccessible because of a capture field naming conflict. In that case, call with CaptureTransformStrategy.NEST
      Since:
      7.3
    • setTimeService

      void setTimeService(TimeService timeService)
      Set a TimeService for the StreamBase Server managed by this Manager. If this call succeeds the timeService object will be set as the current Server-wide time service so it will be shared by all the containers and modules in this StreamBase Engine

      Thread safety note: you can call this method from any thread but you should make sure that it is not called from more than one thread at the same time. Otherwise the result is unpredictable.

      Parameters:
      timeService - a TimeService instance or null. If this is a valid TimeService instance it will be set as the current time service for the entire StreamBase Engine if this is null then StreamBase Engine will use the WallClockTimeService, which is the default TimeService implementation You should obtain a valid TimeService instance via TimeServiceFactory
      Throws:
      UnsupportedOperationException - if there was a problem setting the time service
      Since:
      7.4
    • getTimeService

      TimeService getTimeService() throws StreamBaseException
      Return the current TimeService implementation used by the StreamBase Engine

      Thread safety note: you can call this method from any thread but you should make sure that it is not called from more than one thread at the same time and while this method is called no other thread calls setTimeService method. Otherwise the result is unpredictable.

      Returns:
      the current TimeService
      Throws:
      StreamBaseException - if there was a problem retrieving the current time service
      Since:
      7.4