Library Version 12.1.6.2

DbEnv::repmgr_channel()
Prev | Chapter 11. Replication Methods | Next

## DbEnv::repmgr_channel()

    #include <db_cxx.h>

    int
    DbEnv::repmgr_channel(int eid, DB_CHANNEL **channelp, u_int32_t flags);

The `DbEnv::repmgr_channel()` method returns a DbChannel handle. This is used to create and manage custom message traffic between the sites in the replication group.

This method allocates memory for the handle, returning a pointer to the structure in the memory to which channelp refers. To release the allocated memory and discard the handle, call the DbChannel::close() method.

The `DbEnv::repmgr_channel()` method may be called at any time after DbEnv::repmgr_start() has been called with a `0` return code.

The `DbEnv::repmgr_channel()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### eid

This parameter must be set to one of the following:

- The numerical environment ID of a remote site in the replication group.

- `DB_EID_MASTER`

  Messages sent on this channel are sent only to the master site. Note that messages are always sent to the current master, even if the master has changed since the channel was opened. If the current master is disconnected or unknown, the operation fails and Replication Manager returns an error code.

  If the local site is the master, then sending messages on this channel will result in the local site receiving those messages echoed back to itself.

#### channelp

References memory into which a pointer to the allocated handle is copied.

#### flags

This parameter is currently unused, and must be set to 0.

### Errors

The `DbEnv::repmgr_channel()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### DB_REP_UNAVAIL

If the eid parameter is `DB_EID_MASTER` but the current master is disconnected or unknown.

#### EINVAL

If this method is called from a Base API application; or if an invalid flag value or parameter was specified.

### Class

DbEnv

### See Also

Replication and Related Methods, The DbChannel Handle

Prev | Up | Next
DbEnv::rep_sync() | Home | DbEnv::repmgr_local_site()