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 Summary
Modifier and TypeClassDescriptionstatic interface
Interface use to track progress of file upload. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
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
Submit jar file.static String
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)
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
zkDigestPattern
-
-
Constructor Details
-
StormSubmitter
public StormSubmitter()
-
-
Method Details
-
validateZKDigestPayload
-
prepareZookeeperAuthentication
-
pushCredentials
public 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. SeeConfig
.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 aliveInvalidTopologyException
- if any other error happens
-
pushCredentials
public 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. SeeConfig
.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 aliveInvalidTopologyException
- if any other error happens
-
submitTopology
public 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. SeeConfig
.topology
- the processing to execute.- Throws:
AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedSubmitterHookException
- if any Exception occurs during initialization or invocation of registeredISubmitterHook
-
submitTopology
public 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. SeeConfig
.topology
- the processing to execute.opts
- to manipulate the starting of the topology.- Throws:
AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedSubmitterHookException
- if any Exception occurs during initialization or invocation of registeredISubmitterHook
-
submitTopology
public 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. SeeConfig
.topology
- the processing to execute.opts
- to manipulate the starting of the topologyprogressListener
- to track the progress of the jar upload processStormSubmitter.ProgressListener
- Throws:
AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedSubmitterHookException
- if any Exception occurs during initialization or invocation of registeredISubmitterHook
-
submitTopologyAs
public 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 confsSubmitterHookException
- if any Exception occurs during initialization or invocation of registeredISubmitterHook
AlreadyAliveException
InvalidTopologyException
AuthorizationException
-
submitTopologyWithProgressBar
public 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. SeeConfig
.topology
- the processing to execute.- Throws:
AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failed
-
submitTopologyWithProgressBar
public 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. SeeConfig
.topology
- the processing to execute.opts
- to manipulate the starting of the topology- Throws:
AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedSubmitterHookException
- if any Exception occurs during initialization or invocation of registeredISubmitterHook
-
submitJar
Submit jar file.- Parameters:
conf
- the topology-specific configuration. SeeConfig
.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. SeeConfig
.localJar
- file path of the jar file to submitlistener
- 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
-