Package org.apache.storm

# Class StormSubmitter

java.lang.Object
org.apache.storm.StormSubmitter

public class StormSubmitter extends Object
Use this class to submit topologies to run on the Storm cluster. You should run your program with the "storm jar" command from the command-line, and then use this class to submit your topologies.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `StormSubmitter.ProgressListener`
  Interface use to track progress of file upload.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final org.slf4j.Logger`
  `LOG`
  `static final Pattern`
  `zkDigestPattern`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StormSubmitter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Map<String,Object>`
  `prepareZookeeperAuthentication(Map<String,Object> conf)`
  `static boolean`
  `pushCredentials(String name, Map<String,Object> topoConf, Map<String,String> credentials)`
  Push a new set of credentials to the running topology.
  `static boolean`
  `pushCredentials(String name, Map<String,Object> topoConf, Map<String,String> credentials, String expectedUser)`
  Push a new set of credentials to the running topology.
  `static String`
  `submitJar(Map<String,Object> conf, String localJar)`
  Submit jar file.
  `static String`
  `submitJar(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener)`
  Submit jar file.
  `static String`
  `submitJarAs(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener, String asUser)`
  `static String`
  `submitJarAs(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener, NimbusClient client)`
  `static void`
  `submitTopology(String name, Map<String,Object> topoConf, StormTopology topology)`
  Submits a topology to run on the cluster.
  `static void`
  `submitTopology(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts)`
  Submits a topology to run on the cluster.
  `static void`
  `submitTopology(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener)`
  Submits a topology to run on the cluster.
  `static void`
  `submitTopologyAs(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener, String asUser)`
  Submits a topology to run on the cluster as a particular user.
  `static void`
  `submitTopologyWithProgressBar(String name, Map<String,Object> topoConf, StormTopology topology)`
  Submits a topology to run on the cluster with a progress bar.
  `static void`
  `submitTopologyWithProgressBar(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts)`
  Submits a topology to run on the cluster with a progress bar.
  `static boolean`
  `validateZKDigestPayload(String payload)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LOG

    public static final org.slf4j.Logger LOG

  - ### zkDigestPattern

    public static final Pattern zkDigestPattern

- ## Constructor Details

  - ### StormSubmitter

    public StormSubmitter()

- ## Method Details

  - ### validateZKDigestPayload

    public static boolean validateZKDigestPayload(String payload)

  - ### prepareZookeeperAuthentication

    public static Map<String,Object> prepareZookeeperAuthentication(Map<String,Object> conf)

  - ### pushCredentials

    public static boolean pushCredentials(String name, Map<String,Object> topoConf, Map<String,String> credentials) throws AuthorizationException, NotAliveException, InvalidTopologyException
    Push a new set of credentials to the running topology.
    Parameters:
      `name` - the name of the topology to push credentials to.
      `topoConf` - the topology-specific configuration, if desired. See `Config`.
      `credentials` - the credentials to push.
    Returns:
      whether the pushed credential collection is non-empty. Return false if empty.
    Throws:
      `AuthorizationException` - if you are not authorized ot push credentials.
      `NotAliveException` - if the topology is not alive
      `InvalidTopologyException` - if any other error happens

  - ### pushCredentials

    public static boolean pushCredentials(String name, Map<String,Object> topoConf, Map<String,String> credentials, String expectedUser) throws AuthorizationException, NotAliveException, InvalidTopologyException
    Push a new set of credentials to the running topology. Return false if push Creds map is empty, true otherwise.
    Parameters:
      `name` - the name of the topology to push credentials to.
      `topoConf` - the topology-specific configuration, if desired. See `Config`.
      `credentials` - the credentials to push.
      `expectedUser` - the user you expect the topology to be owned by.
    Returns:
      whether the pushed credential collection is non-empty. Return false if empty.
    Throws:
      `AuthorizationException` - if you are not authorized ot push credentials.
      `NotAliveException` - if the topology is not alive
      `InvalidTopologyException` - if any other error happens

  - ### submitTopology

    public static void submitTopology(String name, Map<String,Object> topoConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException
    Submits a topology to run on the cluster. A topology runs forever or until explicitly killed.
    Parameters:
      `name` - the name of the storm.
      `topoConf` - the topology-specific configuration. See `Config`.
      `topology` - the processing to execute.
    Throws:
      `AlreadyAliveException` - if a topology with this name is already running
      `InvalidTopologyException` - if an invalid topology was submitted
      `AuthorizationException` - if authorization is failed
      `SubmitterHookException` - if any Exception occurs during initialization or invocation of registered `ISubmitterHook`

  - ### submitTopology

    public static void submitTopology(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException
    Submits a topology to run on the cluster. A topology runs forever or until explicitly killed.
    Parameters:
      `name` - the name of the storm.
      `topoConf` - the topology-specific configuration. See `Config`.
      `topology` - the processing to execute.
      `opts` - to manipulate the starting of the topology.
    Throws:
      `AlreadyAliveException` - if a topology with this name is already running
      `InvalidTopologyException` - if an invalid topology was submitted
      `AuthorizationException` - if authorization is failed
      `SubmitterHookException` - if any Exception occurs during initialization or invocation of registered `ISubmitterHook`

  - ### submitTopology

    public static void submitTopology(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException
    Submits a topology to run on the cluster. A topology runs forever or until explicitly killed.
    Parameters:
      `name` - the name of the storm.
      `topoConf` - the topology-specific configuration. See `Config`.
      `topology` - the processing to execute.
      `opts` - to manipulate the starting of the topology
      `progressListener` - to track the progress of the jar upload process `StormSubmitter.ProgressListener`
    Throws:
      `AlreadyAliveException` - if a topology with this name is already running
      `InvalidTopologyException` - if an invalid topology was submitted
      `AuthorizationException` - if authorization is failed
      `SubmitterHookException` - if any Exception occurs during initialization or invocation of registered `ISubmitterHook`

  - ### submitTopologyAs

    public static void submitTopologyAs(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener, String asUser) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException, IllegalArgumentException
    Submits a topology to run on the cluster as a particular user. A topology runs forever or until explicitly killed.
    Parameters:
      `asUser` - The user as which this topology should be submitted.
    Throws:
      `IllegalArgumentException` - thrown if configs will yield an unschedulable topology. validateConfs validates confs
      `SubmitterHookException` - if any Exception occurs during initialization or invocation of registered `ISubmitterHook`
      `AlreadyAliveException`
      `InvalidTopologyException`
      `AuthorizationException`

  - ### submitTopologyWithProgressBar

    public static void submitTopologyWithProgressBar(String name, Map<String,Object> topoConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException
    Submits a topology to run on the cluster with a progress bar. A topology runs forever or until explicitly killed.
    Parameters:
      `name` - the name of the storm.
      `topoConf` - the topology-specific configuration. See `Config`.
      `topology` - the processing to execute.
    Throws:
      `AlreadyAliveException` - if a topology with this name is already running
      `InvalidTopologyException` - if an invalid topology was submitted
      `AuthorizationException` - if authorization is failed

  - ### submitTopologyWithProgressBar

    public static void submitTopologyWithProgressBar(String name, Map<String,Object> topoConf, StormTopology topology, SubmitOptions opts) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException
    Submits a topology to run on the cluster with a progress bar. A topology runs forever or until explicitly killed.
    Parameters:
      `name` - the name of the storm.
      `topoConf` - the topology-specific configuration. See `Config`.
      `topology` - the processing to execute.
      `opts` - to manipulate the starting of the topology
    Throws:
      `AlreadyAliveException` - if a topology with this name is already running
      `InvalidTopologyException` - if an invalid topology was submitted
      `AuthorizationException` - if authorization is failed
      `SubmitterHookException` - if any Exception occurs during initialization or invocation of registered `ISubmitterHook`

  - ### submitJar

    public static String submitJar(Map<String,Object> conf, String localJar)
    Submit jar file.
    Parameters:
      `conf` - the topology-specific configuration. See `Config`.
      `localJar` - file path of the jar file to submit
    Returns:
      the remote location of the submitted jar

  - ### submitJar

    public static String submitJar(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener)
    Submit jar file.
    Parameters:
      `conf` - the topology-specific configuration. See `Config`.
      `localJar` - file path of the jar file to submit
      `listener` - progress listener to track the jar file upload
    Returns:
      the remote location of the submitted jar

  - ### submitJarAs

    public static String submitJarAs(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener, NimbusClient client)

  - ### submitJarAs

    public static String submitJarAs(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener, String asUser)