@ConnectionManagement(friendlyName="Configuration", configElementName="config") public class Config extends Object implements AbstractConfig
Modifier and Type | Field and Description |
---|---|
static String |
COMMA_SEPARATED_REGEX |
Integer |
connectionsPerHost
The number of connections allowed per host (the pool size, per host)
|
Integer |
maxWaitTime
The max wait time for a blocking thread for a connection from the pool in ms.
|
Integer |
threadsAllowedToBlockForConnectionMultiplier
Multiplier for connectionsPerHost for # of threads that can block.
|
Constructor and Description |
---|
Config() |
Modifier and Type | Method and Description |
---|---|
void |
connect(String username,
String password,
String database)
Method invoked when a Mongo session needs to be created.
|
String |
connectionId() |
void |
disconnect()
Method invoked when the Mongo session is to be destroyed.
|
protected static List<com.mongodb.ServerAddress> |
getAddresses(String commaSeparatedHosts) |
String |
getAuthenticationDatabase() |
MongoClient |
getClient() |
Integer |
getConnectionsPerHost() |
Integer |
getConnectTimeout() |
String |
getDatabase() |
String |
getHost() |
Integer |
getMaxWaitTime() |
Integer |
getSocketTimeout() |
boolean |
getSsl() |
Integer |
getThreadsAllowedToBlockForConnectionMultiplier() |
boolean |
isConnected() |
void |
setAuthenticationDatabase(String authenticationDatabase) |
void |
setConnectionsPerHost(Integer connectionsPerHost) |
void |
setConnectTimeout(Integer connectTimeout) |
void |
setDatabase(String database) |
void |
setHost(String host) |
void |
setMaxWaitTime(Integer maxWaitTime) |
void |
setSocketTimeout(Integer socketTimeout) |
void |
setSsl(boolean ssl) |
void |
setThreadsAllowedToBlockForConnectionMultiplier(Integer threadsAllowedToBlockForConnectionMultiplier) |
void |
testConnect(String username,
String password,
String database)
Method invoked when testing connectivity
|
public static final String COMMA_SEPARATED_REGEX
@Configurable @Optional public Integer connectionsPerHost
@Configurable @Optional public Integer threadsAllowedToBlockForConnectionMultiplier
@Configurable @Optional public Integer maxWaitTime
protected static List<com.mongodb.ServerAddress> getAddresses(@NotNull String commaSeparatedHosts) throws org.mule.api.ConnectionException
org.mule.api.ConnectionException
public MongoClient getClient()
getClient
in interface AbstractConfig
@Connect(strategy=SINGLE_INSTANCE) public void connect(@Default(value="") String username, @Optional@Password String password, @ConnectionKey String database) throws org.mule.api.ConnectionException
username
- the username to use for authentication.password
- the password to use for authentication. If the password is null or whitespaces only, the connector won't use authentication and username must be empty too.database
- Name of the databaseorg.mule.api.ConnectionException
- if connection cannot be established@TestConnectivity public void testConnect(@ConnectionKey String username, @Optional@Password String password, @ConnectionKey String database) throws org.mule.api.ConnectionException
username
- the username to use for authentication.password
- the password to use for authentication. If the password is null or whitespaces only, the connector won't use authentication and username must be empty too.database
- Name of the databaseorg.mule.api.ConnectionException
- if connection cannot be established@Disconnect public void disconnect()
@ValidateConnection public boolean isConnected()
@ConnectionIdentifier public String connectionId()
public String getHost()
public void setHost(String host)
public String getDatabase()
getDatabase
in interface AbstractConfig
public void setDatabase(String database)
public Integer getConnectionsPerHost()
public void setConnectionsPerHost(Integer connectionsPerHost)
public Integer getThreadsAllowedToBlockForConnectionMultiplier()
public void setThreadsAllowedToBlockForConnectionMultiplier(Integer threadsAllowedToBlockForConnectionMultiplier)
public Integer getMaxWaitTime()
public void setMaxWaitTime(Integer maxWaitTime)
public Integer getConnectTimeout()
public void setConnectTimeout(Integer connectTimeout)
public Integer getSocketTimeout()
public void setSocketTimeout(Integer socketTimeout)
public boolean getSsl()
public void setSsl(boolean ssl)
public void setAuthenticationDatabase(String authenticationDatabase)
public String getAuthenticationDatabase()
Copyright © 2010–2017. All rights reserved.