org.apache.ignite.internal.client.router

## Class GridRouterFactory

- java.lang.Object
- - org.apache.ignite.internal.client.router.GridRouterFactory

    public final class GridRouterFactory
    extends Object

This factory is responsible for router lifecycle management. All router should be started, accessed and stopped through this factory.

# Embedding router

You can use `GridTcpRouterConfiguration` to set configuration parameters and pass them to `startTcpRouter(GridTcpRouterConfiguration)`.

See `GridTcpRouter` for example on how to configure and start embedded router.

# Standalone router startup

Alternatively you can run routers as a standalone processes by executing `IGNITE_HOME/bin/igniterouter.sh` or `IGNITE_HOME/bin/igniterouter.bat`. They both accept path to a configuration file as first command line argument. See `IGNITE_HOME/config/router/default-router.xml` for configuration example.

See Also:
  `GridTcpRouter`

### Method Summary

Methods
`static Collection<GridTcpRouter>` `allTcpRouters()` Returns collection of all currently running TCP routers.
`static GridTcpRouter` `startTcpRouter(GridTcpRouterConfiguration cfg)` Starts a TCP router with given configuration.
`static void` `stopAllRouters()` Stops all currently active routers.
`static void` `stopTcpRouter(UUID tcpRouterId)` Stops particular TCP router.
`static GridTcpRouter` `tcpRouter(UUID id)` Returns TCP router with the given id.

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

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

### Method Detail

#### startTcpRouter

    public static GridTcpRouter startTcpRouter(GridTcpRouterConfiguration cfg)
                                        throws IgniteCheckedException

Starts a TCP router with given configuration.

Starting router will be assigned a randomly generated UUID which can be obtained by `GridTcpRouter.id()` method. Later this instance could be obtained via `tcpRouter(java.util.UUID)` method.

Parameters:
  `cfg` - Router configuration.
Returns:
  Started router.
Throws:
  `IgniteCheckedException` - If router start failed.

#### stopTcpRouter

    public static void stopTcpRouter(UUID tcpRouterId)

Stops particular TCP router.

Parameters:
  `tcpRouterId` - Id of the router to stop.

#### tcpRouter

    @Nullable
    public static GridTcpRouter tcpRouter(UUID id)

Returns TCP router with the given id.

Parameters:
  `id` - Router Id.
Returns:
  Router with the given id or `null` if router not found.

#### allTcpRouters

    public static Collection<GridTcpRouter> allTcpRouters()

Returns collection of all currently running TCP routers.

Returns:
  Collection of currently running `GridTcpRouter`s.

#### stopAllRouters

    public static void stopAllRouters()

Stops all currently active routers.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0.final
Release Date | : December 29 2015