org.apache.storm

## Class LocalCluster.Builder

- java.lang.Object
- - org.apache.storm.LocalCluster.Builder

- Enclosing class:
    LocalCluster

      public static class LocalCluster.Builder
      extends Object

  Simple way to configure a LocalCluster to meet your needs.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Builder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `LocalCluster` | `build()` Builds a new LocalCluster.
    `LocalCluster.Builder` | `withBlobStore(BlobStore store)` Use the following blobstore instead of the one in the config.
    `LocalCluster.Builder` | `withClusterState(IStormClusterState clusterState)` Use the following clusterState instead of the one in the config.
    `LocalCluster.Builder` | `withDaemonConf(Map<String,Object> conf)` Set the base config that the daemons should use.
    `LocalCluster.Builder` | `withDaemonConf(String key, Object value)` Add an single key/value config to the daemon conf.
    `LocalCluster.Builder` | `withGroupMapper(IGroupMappingServiceProvider groupMapper)` Override the code that maps users to groups for authorization.
    `LocalCluster.Builder` | `withINimbus(INimbus inimbus)` Override the INimbus instance that nimbus will use.
    `LocalCluster.Builder` | `withLeaderElector(ILeaderElector leaderElector)` Use the following leaderElector instead of the one in the config.
    `LocalCluster.Builder` | `withNimbusDaemon()` Have the local nimbus actually launch a thrift server.
    `LocalCluster.Builder` | `withNimbusDaemon(Boolean nimbusDaemon)` If nimbusDaemon is true the local nimbus will launch a thrift server.
    `LocalCluster.Builder` | `withNimbusWrapper(UnaryOperator<Nimbus> nimbusWrapper)` Before nimbus is created/used call nimbusWrapper on it first and use the result instead.
    `LocalCluster.Builder` | `withPortsPerSupervisor(int portsPerSupervisor)` Set the number of slots/ports each supervisor should have.
    `LocalCluster.Builder` | `withSimulatedTime()` Turn on simulated time in the cluster.
    `LocalCluster.Builder` | `withSimulatedTime(boolean simulateTime)` Turn on simulated time in the cluster.
    `LocalCluster.Builder` | `withSupervisors(int supervisors)` Set the number of supervisors the cluster should have.
    `LocalCluster.Builder` | `withSupervisorSlotPortMin(Number minPort)` When assigning ports to worker slots start at minPort.
    `LocalCluster.Builder` | `withTopoCache(TopoCache topoCache)` Use the following topo cache instead of creating out own.
    `LocalCluster.Builder` | `withTracked()` A tracked cluster can run tracked topologies.
    `LocalCluster.Builder` | `withTracked(String trackId)` A tracked cluster can run tracked topologies.

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder()

  - ### Method Detail

    - #### withSupervisors

          public LocalCluster.Builder withSupervisors(int supervisors)

      Set the number of supervisors the cluster should have.

    - #### withPortsPerSupervisor

          public LocalCluster.Builder withPortsPerSupervisor(int portsPerSupervisor)

      Set the number of slots/ports each supervisor should have.

    - #### withDaemonConf

          public LocalCluster.Builder withDaemonConf(Map<String,Object> conf)

      Set the base config that the daemons should use.

    - #### withDaemonConf

          public LocalCluster.Builder withDaemonConf(String key,
                                                     Object value)

      Add an single key/value config to the daemon conf.

    - #### withINimbus

          public LocalCluster.Builder withINimbus(INimbus inimbus)

      Override the INimbus instance that nimbus will use.

    - #### withGroupMapper

          public LocalCluster.Builder withGroupMapper(IGroupMappingServiceProvider groupMapper)

      Override the code that maps users to groups for authorization.

    - #### withSupervisorSlotPortMin

          public LocalCluster.Builder withSupervisorSlotPortMin(Number minPort)

      When assigning ports to worker slots start at minPort.

    - #### withNimbusDaemon

          public LocalCluster.Builder withNimbusDaemon()

      Have the local nimbus actually launch a thrift server. This is intended to be used mostly for internal storm testing.

    - #### withNimbusDaemon

          public LocalCluster.Builder withNimbusDaemon(Boolean nimbusDaemon)

      If nimbusDaemon is true the local nimbus will launch a thrift server. This is intended to be used mostly for internal storm testing.

    - #### withSimulatedTime

          public LocalCluster.Builder withSimulatedTime()

      Turn on simulated time in the cluster. This allows someone to simulate long periods of time for timeouts etc when testing nimbus/supervisors themselves. NOTE: that this only works for code that uses the `Time` class for time management so it will not work in all cases.

    - #### withSimulatedTime

          public LocalCluster.Builder withSimulatedTime(boolean simulateTime)

      Turn on simulated time in the cluster. This allows someone to simulate long periods of time for timeouts etc when testing nimbus/supervisors themselves. NOTE: that this only works for code that uses the `Time` class for time management so it will not work in all cases.

    - #### withNimbusWrapper

          public LocalCluster.Builder withNimbusWrapper(UnaryOperator<Nimbus> nimbusWrapper)

      Before nimbus is created/used call nimbusWrapper on it first and use the result instead. This is intended for internal testing only, and it here to allow a mocking framework to spy on the nimbus class.

    - #### withBlobStore

          public LocalCluster.Builder withBlobStore(BlobStore store)

      Use the following blobstore instead of the one in the config. This is intended mostly for internal testing with Mocks.

    - #### withTopoCache

          public LocalCluster.Builder withTopoCache(TopoCache topoCache)

      Use the following topo cache instead of creating out own. This is intended mostly for internal testing with Mocks.

    - #### withClusterState

          public LocalCluster.Builder withClusterState(IStormClusterState clusterState)

      Use the following clusterState instead of the one in the config. This is intended mostly for internal testing with Mocks.

    - #### withLeaderElector

          public LocalCluster.Builder withLeaderElector(ILeaderElector leaderElector)

      Use the following leaderElector instead of the one in the config. This is intended mostly for internal testing with Mocks.

    - #### withTracked

          public LocalCluster.Builder withTracked(String trackId)

      A tracked cluster can run tracked topologies. See `TrackedTopology` for more information on tracked topologies.

      Parameters:
        `trackId` - an arbitrary unique id that is used to keep track of tracked topologies

    - #### withTracked

          public LocalCluster.Builder withTracked()

      A tracked cluster can run tracked topologies. See `TrackedTopology` for more information on tracked topologies.

    - #### build

          public LocalCluster build()
                             throws Exception

      Builds a new LocalCluster.

      Returns:
        the LocalCluster
      Throws:
        `Exception` - on any one of many different errors. This is intended for testing so yes it is ugly and throws Exception…

Copyright © 2019 The Apache Software Foundation. All rights reserved.