Class RMQConnectionConfig.Builder
- java.lang.Object
-
- org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfig.Builder
-
- Enclosing class:
- RMQConnectionConfig
public static class RMQConnectionConfig.Builder extends Object
The Builder Class forRMQConnectionConfig.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RMQConnectionConfigbuild()The Builder method.RMQConnectionConfig.BuildersetAutomaticRecovery(boolean automaticRecovery)Enables or disables automatic connection recovery.RMQConnectionConfig.BuildersetConnectionTimeout(int connectionTimeout)Set the connection timeout.RMQConnectionConfig.BuildersetDeliveryTimeout(long deliveryTimeout)Enables setting the message delivery timeout in the queueing consumer.RMQConnectionConfig.BuildersetDeliveryTimeout(long deliveryTimeout, TimeUnit unit)Enables setting the message delivery timeout in the queueing consumer.RMQConnectionConfig.BuildersetHost(String host)RMQConnectionConfig.BuildersetNetworkRecoveryInterval(int networkRecoveryInterval)Sets connection recovery interval.RMQConnectionConfig.BuildersetPassword(String password)Set the password.RMQConnectionConfig.BuildersetPort(int port)Set the target port.RMQConnectionConfig.BuildersetPrefetchCount(int prefetchCount)Enables setting basicQos for the consumer channel.RMQConnectionConfig.BuildersetRequestedChannelMax(int requestedChannelMax)Set the requested maximum channel number.RMQConnectionConfig.BuildersetRequestedFrameMax(int requestedFrameMax)Set the requested maximum frame size.RMQConnectionConfig.BuildersetRequestedHeartbeat(int requestedHeartbeat)Set the requested heartbeat.RMQConnectionConfig.BuildersetTopologyRecoveryEnabled(boolean topologyRecovery)Enables or disables topology recovery.RMQConnectionConfig.BuildersetUri(String uri)Convenience method for setting the fields in an AMQP URI: host, port, username, password and virtual host.RMQConnectionConfig.BuildersetUserName(String username)Set the user name.RMQConnectionConfig.BuildersetVirtualHost(String virtualHost)Set the virtual host.
-
-
-
Method Detail
-
setPort
public RMQConnectionConfig.Builder setPort(int port)
Set the target port.- Parameters:
port- the default port to use for connections- Returns:
- the Builder
-
setHost
public RMQConnectionConfig.Builder setHost(String host)
- Parameters:
host- the default host to use for connections- Returns:
- the Builder
-
setVirtualHost
public RMQConnectionConfig.Builder setVirtualHost(String virtualHost)
Set the virtual host.- Parameters:
virtualHost- the virtual host to use when connecting to the broker- Returns:
- the Builder
-
setUserName
public RMQConnectionConfig.Builder setUserName(String username)
Set the user name.- Parameters:
username- the AMQP user name to use when connecting to the broker- Returns:
- the Builder
-
setPassword
public RMQConnectionConfig.Builder setPassword(String password)
Set the password.- Parameters:
password- the password to use when connecting to the broker- Returns:
- the Builder
-
setUri
public RMQConnectionConfig.Builder setUri(String uri)
Convenience method for setting the fields in an AMQP URI: host, port, username, password and virtual host. If any part of the URI is omitted, the ConnectionFactory's corresponding variable is left unchanged.- Parameters:
uri- is the AMQP URI containing the data- Returns:
- the Builder
-
setTopologyRecoveryEnabled
public RMQConnectionConfig.Builder setTopologyRecoveryEnabled(boolean topologyRecovery)
Enables or disables topology recovery.- Parameters:
topologyRecovery- if true, enables topology recovery- Returns:
- the Builder
-
setRequestedHeartbeat
public RMQConnectionConfig.Builder setRequestedHeartbeat(int requestedHeartbeat)
Set the requested heartbeat.- Parameters:
requestedHeartbeat- the initially requested heartbeat interval, in seconds; zero for none- Returns:
- the Builder
-
setRequestedFrameMax
public RMQConnectionConfig.Builder setRequestedFrameMax(int requestedFrameMax)
Set the requested maximum frame size.- Parameters:
requestedFrameMax- initially requested maximum frame size, in octets; zero for unlimited- Returns:
- the Builder
-
setRequestedChannelMax
public RMQConnectionConfig.Builder setRequestedChannelMax(int requestedChannelMax)
Set the requested maximum channel number.- Parameters:
requestedChannelMax- initially requested maximum channel number; zero for unlimited
-
setNetworkRecoveryInterval
public RMQConnectionConfig.Builder setNetworkRecoveryInterval(int networkRecoveryInterval)
Sets connection recovery interval. Default is 5000.- Parameters:
networkRecoveryInterval- how long will automatic recovery wait before attempting to reconnect, in ms- Returns:
- the Builder
-
setConnectionTimeout
public RMQConnectionConfig.Builder setConnectionTimeout(int connectionTimeout)
Set the connection timeout.- Parameters:
connectionTimeout- connection establishment timeout in milliseconds; zero for infinite- Returns:
- the Builder
-
setAutomaticRecovery
public RMQConnectionConfig.Builder setAutomaticRecovery(boolean automaticRecovery)
Enables or disables automatic connection recovery.- Parameters:
automaticRecovery- if true, enables connection recovery- Returns:
- the Builder
-
setPrefetchCount
public RMQConnectionConfig.Builder setPrefetchCount(int prefetchCount)
Enables setting basicQos for the consumer channel. Only applicable to theRMQSource. Set to 0 for unlimited, which is the default.- Parameters:
prefetchCount- the max number of messages to receive without acknowledgement.- Returns:
- the Builder
- See Also:
- Consumer Prefetch, Channel Prefetch (QoS)
-
setDeliveryTimeout
public RMQConnectionConfig.Builder setDeliveryTimeout(long deliveryTimeout)
Enables setting the message delivery timeout in the queueing consumer. Only applicable to theRMQSource. If not set it will default to 30000.- Parameters:
deliveryTimeout- maximum wait time, in milliseconds, for the next message delivery- Returns:
- the Builder
-
setDeliveryTimeout
public RMQConnectionConfig.Builder setDeliveryTimeout(long deliveryTimeout, TimeUnit unit)
Enables setting the message delivery timeout in the queueing consumer. Only applicable to theRMQSource. If not set it will default to 30 seconds.- Parameters:
deliveryTimeout- maximum wait time for the next message deliveryunit- deliveryTimeout unit- Returns:
- the Builder
-
build
public RMQConnectionConfig build()
The Builder method.If URI is NULL we use host, port, vHost, username, password combination to initialize connection. using
RMQConnectionConfig(String, Integer, String, String, String, Integer, Boolean, Boolean, Integer, Integer, Integer, Integer, Integer, Long).Otherwise the URI will be used to initialize the client connection
RMQConnectionConfig(String, Integer, Boolean, Boolean, Integer, Integer, Integer, Integer, Integer, Long)- Returns:
- RMQConnectionConfig
-
-