Search in sources :

Example 1 with SSLConfig

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}");
}
Also used : Exchange(org.apache.camel.Exchange) SSLConfig(com.hazelcast.config.SSLConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Processor(org.apache.camel.Processor) GroupConfig(com.hazelcast.config.GroupConfig) HazelcastComponent(org.apache.camel.component.hazelcast.HazelcastComponent) ClientConfig(com.hazelcast.client.config.ClientConfig)

Example 2 with SSLConfig

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));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) SSLConfig(com.hazelcast.config.SSLConfig) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) NonBlockingIOThreadingModel(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)

Example 3 with SSLConfig

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());
}
Also used : SSLConfig(com.hazelcast.config.SSLConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 4 with SSLConfig

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);
}
Also used : SSLConfig(com.hazelcast.config.SSLConfig) NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Aggregations

SSLConfig (com.hazelcast.config.SSLConfig)4 ClientConfig (com.hazelcast.client.config.ClientConfig)1 GroupConfig (com.hazelcast.config.GroupConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)1 NonBlockingIOThreadingModel (com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)1 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Exchange (org.apache.camel.Exchange)1 Processor (org.apache.camel.Processor)1 HazelcastComponent (org.apache.camel.component.hazelcast.HazelcastComponent)1 Test (org.junit.Test)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1 Node (org.w3c.dom.Node)1