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.
Modifier and Type | Class and Description |
---|---|
static interface |
StormSubmitter.ProgressListener
Interface use to track progress of file upload.
|
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
static Pattern |
zkDigestPattern |
Constructor and Description |
---|
StormSubmitter() |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
prepareZookeeperAuthentication(Map<String,Object> conf) |
static void |
pushCredentials(String name,
Map<String,Object> topoConf,
Map<String,String> credentials)
Push a new set of credentials to the running topology.
|
static void |
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,
NimbusClient client) |
static String |
submitJarAs(Map<String,Object> conf,
String localJar,
StormSubmitter.ProgressListener listener,
String asUser) |
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) |
public static final org.slf4j.Logger LOG
public static final Pattern zkDigestPattern
public static boolean validateZKDigestPayload(String payload)
public static Map<String,Object> prepareZookeeperAuthentication(Map<String,Object> conf)
public static void 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.
name
- the name of the topology to push credentials to.topoConf
- the topology-specific configuration, if desired. See Config
.credentials
- the credentials to push.AuthorizationException
- if you are not authorized ot push credentials.NotAliveException
- if the topology is not aliveInvalidTopologyException
- if any other error happenspublic static void 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.
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.AuthorizationException
- if you are not authorized ot push credentials.NotAliveException
- if the topology is not aliveInvalidTopologyException
- if any other error happenspublic 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.
name
- the name of the storm.topoConf
- the topology-specific configuration. See Config
.topology
- the processing to execute.AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedpublic 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.
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.AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedpublic 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.
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 topologyprogressListener
- to track the progress of the jar upload processAlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedpublic 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.
asUser
- The user as which this topology should be submitted.IllegalArgumentException
- thrown if configs will yield an unschedulable topology. validateConfs validates confsAlreadyAliveException
InvalidTopologyException
AuthorizationException
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.
name
- the name of the storm.topoConf
- the topology-specific configuration. See Config
.topology
- the processing to execute.AlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedpublic 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.
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 topologyAlreadyAliveException
- if a topology with this name is already runningInvalidTopologyException
- if an invalid topology was submittedAuthorizationException
- if authorization is failedpublic static String submitJar(Map<String,Object> conf, String localJar)
Submit jar file.
conf
- the topology-specific configuration. See Config
.localJar
- file path of the jar file to submitpublic static String submitJar(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener)
Submit jar file.
conf
- the topology-specific configuration. See Config
.localJar
- file path of the jar file to submitlistener
- progress listener to track the jar file uploadpublic static String submitJarAs(Map<String,Object> conf, String localJar, StormSubmitter.ProgressListener listener, NimbusClient client)
Copyright © 2019 The Apache Software Foundation. All rights reserved.