Package org.apache.storm
Class StormSubmitter
java.lang.Object
org.apache.storm.StormSubmitter
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 SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceInterface use to track progress of file upload.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanPush a new set of credentials to the running topology.static booleanpushCredentials(String name, Map<String, Object> topoConf, Map<String, String> credentials, String expectedUser) Push a new set of credentials to the running topology.static StringSubmit jar file.static StringSubmit jar file.static StringsubmitJarAs(Map<String, Object> conf, String localJar, StormSubmitter.ProgressListener listener, String asUser) static StringsubmitJarAs(Map<String, Object> conf, String localJar, StormSubmitter.ProgressListener listener, NimbusClient client) static voidsubmitTopology(String name, Map<String, Object> topoConf, StormTopology topology) Submits a topology to run on the cluster.static voidsubmitTopology(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts) Submits a topology to run on the cluster.static voidsubmitTopology(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener) Submits a topology to run on the cluster.static voidsubmitTopologyAs(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 voidsubmitTopologyWithProgressBar(String name, Map<String, Object> topoConf, StormTopology topology) Submits a topology to run on the cluster with a progress bar.static voidsubmitTopologyWithProgressBar(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts) Submits a topology to run on the cluster with a progress bar.static booleanvalidateZKDigestPayload(String payload) 
- 
Field Details- 
LOGpublic static final org.slf4j.Logger LOG
- 
zkDigestPattern
 
- 
- 
Constructor Details- 
StormSubmitterpublic StormSubmitter()
 
- 
- 
Method Details- 
validateZKDigestPayload
- 
prepareZookeeperAuthentication
- 
pushCredentialspublic static boolean pushCredentials(String name, Map<String, Object> topoConf, Map<String, throws AuthorizationException, NotAliveException, InvalidTopologyExceptionString> credentials) 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
 
- 
pushCredentialspublic static boolean pushCredentials(String name, Map<String, Object> topoConf, Map<String, throws AuthorizationException, NotAliveException, InvalidTopologyExceptionString> credentials, String expectedUser) 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
 
- 
submitTopologypublic static void submitTopology(String name, Map<String, Object> topoConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException, AuthorizationExceptionSubmits 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
 
- 
submitTopologypublic static void submitTopology(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts) throws AlreadyAliveException, InvalidTopologyException, AuthorizationExceptionSubmits 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
 
- 
submitTopologypublic static void submitTopology(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener) throws AlreadyAliveException, InvalidTopologyException, AuthorizationExceptionSubmits 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
 
- 
submitTopologyAspublic static void submitTopologyAs(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts, StormSubmitter.ProgressListener progressListener, String asUser) throws AlreadyAliveException, InvalidTopologyException, AuthorizationException, IllegalArgumentExceptionSubmits 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
 
- 
submitTopologyWithProgressBarpublic static void submitTopologyWithProgressBar(String name, Map<String, Object> topoConf, StormTopology topology) throws AlreadyAliveException, InvalidTopologyException, AuthorizationExceptionSubmits 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
 
- 
submitTopologyWithProgressBarpublic static void submitTopologyWithProgressBar(String name, Map<String, Object> topoConf, StormTopology topology, SubmitOptions opts) throws AlreadyAliveException, InvalidTopologyException, AuthorizationExceptionSubmits 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
 
- 
submitJarSubmit 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
 
- 
submitJarpublic 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
 
- 
submitJarAspublic static String submitJarAs(Map<String, Object> conf, String localJar, StormSubmitter.ProgressListener listener, NimbusClient client) 
- 
submitJarAs
 
-