use of com.hazelcast.config.SSLConfig in project camel by apache.
the class HazelcastRoute method configure.
@Override
public void configure() throws Exception {
HazelcastComponent component = new HazelcastComponent();
ClientConfig config = new ClientConfig();
config.getNetworkConfig().addAddress("hazelcast");
config.getNetworkConfig().setSSLConfig(new SSLConfig().setEnabled(false));
config.setGroupConfig(new GroupConfig("someGroup", "someSecret"));
HazelcastInstance instance = HazelcastClient.newHazelcastClient(config);
component.setHazelcastInstance(instance);
getContext().addComponent("hazelcast", component);
from("timer:foo?period=5000").log("Producer side: Sending data to Hazelcast topic..").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(HazelcastConstants.OPERATION, HazelcastConstants.PUBLISH_OPERATION);
String payload = "Test " + UUID.randomUUID();
exchange.getIn().setBody(payload);
}
}).to("hazelcast:topic:foo");
from("hazelcast:topic:foo").log("Consumer side: Detected following action: $simple{in.header.CamelHazelcastListenerAction}");
}
use of com.hazelcast.config.SSLConfig in project hazelcast by hazelcast.
the class ClientConnectionManagerImpl method initIOThreads.
protected void initIOThreads(HazelcastClientInstanceImpl client) {
HazelcastProperties properties = client.getProperties();
boolean directBuffer = properties.getBoolean(SOCKET_CLIENT_BUFFER_DIRECT);
SSLConfig sslConfig = client.getClientConfig().getNetworkConfig().getSSLConfig();
boolean sslEnabled = sslConfig != null && sslConfig.isEnabled();
int configuredInputThreads = properties.getInteger(ClientProperty.IO_INPUT_THREAD_COUNT);
int configuredOutputThreads = properties.getInteger(ClientProperty.IO_OUTPUT_THREAD_COUNT);
int inputThreads;
if (configuredInputThreads == -1) {
inputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
} else {
inputThreads = configuredInputThreads;
}
int outputThreads;
if (configuredOutputThreads == -1) {
outputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
} else {
outputThreads = configuredOutputThreads;
}
ioThreadingModel = new NonBlockingIOThreadingModel(client.getLoggingService(), client.getMetricsRegistry(), new HazelcastThreadGroup(client.getName(), logger, client.getClientConfig().getClassLoader()), outOfMemoryHandler, inputThreads, outputThreads, properties.getInteger(ClientProperty.IO_BALANCER_INTERVAL_SECONDS), new ClientSocketWriterInitializer(getBufferSize(), directBuffer), new ClientSocketReaderInitializer(getBufferSize(), directBuffer));
}
use of com.hazelcast.config.SSLConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testSSLConfig.
@Test
public void testSSLConfig() {
SSLConfig sslConfig = config.getNetworkConfig().getSSLConfig();
assertNotNull(sslConfig);
assertFalse(sslConfig.isEnabled());
assertEquals(DummySSLContextFactory.class.getName(), sslConfig.getFactoryClassName());
assertEquals(sslContextFactory, sslConfig.getFactoryImplementation());
}
use of com.hazelcast.config.SSLConfig in project hazelcast by hazelcast.
the class XmlClientConfigBuilder method handleSSLConfig.
private void handleSSLConfig(Node node, ClientNetworkConfig clientNetworkConfig) {
SSLConfig sslConfig = new SSLConfig();
NamedNodeMap atts = node.getAttributes();
Node enabledNode = atts.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode).trim());
sslConfig.setEnabled(enabled);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("factory-class-name".equals(nodeName)) {
sslConfig.setFactoryClassName(getTextContent(n).trim());
} else if ("properties".equals(nodeName)) {
fillProperties(n, sslConfig.getProperties());
}
}
clientNetworkConfig.setSSLConfig(sslConfig);
}
Aggregations