本文整理汇总了Java中com.rabbitmq.client.impl.nio.NioParams类的典型用法代码示例。如果您正苦于以下问题:Java NioParams类的具体用法?Java NioParams怎么用?Java NioParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NioParams类属于com.rabbitmq.client.impl.nio包,在下文中一共展示了NioParams类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBasicProperties
import com.rabbitmq.client.impl.nio.NioParams; //导入依赖的package包/类
private void setBasicProperties () {
final NioParams nioParams = new NioParams()
.setNbIoThreads(1)
.setWriteEnqueuingTimeoutInMs(0)
.setWriteByteBufferSize(VALUE_SET_WRITE_BUFFER_SIZE);
RABBITMQ_CONNECTION_FACTORY.useNio();
RABBITMQ_CONNECTION_FACTORY.setNioParams(nioParams);
RABBITMQ_CONNECTION_FACTORY.setConnectionTimeout(VALUE_CONNECTION_TIMEOUT_MS);
RABBITMQ_CONNECTION_FACTORY.setChannelRpcTimeout(VALUE_RPC_CALL_TIMEOUT_MS);
RABBITMQ_CONNECTION_FACTORY.setHandshakeTimeout(VALUE_HANDSHAKE_CONNECTION_TIMEOUT_MS);
ExecutorService shutdownExecutor = Executors.newSingleThreadExecutor();
RABBITMQ_CONNECTION_FACTORY.setShutdownExecutor(shutdownExecutor);
RABBITMQ_CONNECTION_FACTORY.setShutdownTimeout(VALUE_SHUTDOWN_TIMEOUT_MS);
RABBITMQ_CONNECTION_FACTORY.setRequestedHeartbeat(VALUE_REQUESTED_HEART_BEAT);
RABBITMQ_CONNECTION_FACTORY.setAutomaticRecoveryEnabled(VALUE_AUTOMATIC_RECOVERY);
RABBITMQ_CONNECTION_FACTORY.setTopologyRecoveryEnabled(VALUE_AUTOMATIC_EXCHANGE_RECOVERY);
RABBITMQ_CONNECTION_FACTORY.setNetworkRecoveryInterval(VALUE_AUTOMATIC_RECOVERY_NETWORK_DELAY_MS);
RABBITMQ_CONNECTION_FACTORY.setVirtualHost(this.virtualHost);
RABBITMQ_CONNECTION_FACTORY.setSocketConfigurator(new DefaultSocketConfigurator() {
@Override
public void configure(Socket socket) throws IOException {
socket.setTcpNoDelay(VALUE_DONT_USE_NAGLE);
socket.setReceiveBufferSize(VALUE_SET_WRITE_BUFFER_SIZE);
socket.setSendBufferSize(VALUE_SET_SEND_BUFFER_SIZE);
socket.setPerformancePreferences(0, 2, 1);
socket.setReuseAddress(true);
socket.setKeepAlive(VALUE_TCP_KEELALIVE);
socket.setSoLinger(true, 1000);
}
});
}
示例2: withNioParams
import com.rabbitmq.client.impl.nio.NioParams; //导入依赖的package包/类
/**
* Support for Java non-blocking IO
*
* @param nioParams The NIO mode can be configured through the NioParams class
*/
public ConnectionOptions withNioParams(NioParams nioParams) {
this.nioParams = nioParams;
factory.setNioParams(Assert.notNull(nioParams, "nioParams"));
factory.useNio();
return this;
}
示例3: getNioParams
import com.rabbitmq.client.impl.nio.NioParams; //导入依赖的package包/类
public NioParams getNioParams() {
return nioParams;
}
示例4: getNioParams
import com.rabbitmq.client.impl.nio.NioParams; //导入依赖的package包/类
/**
* Return NioParams object.
* @see #withNioParams(NioParams)
* @see #withNio()
*/
public NioParams getNioParams() {
return nioParams;
}