Search in sources :

Example 1 with SmppSessionConfiguration

use of com.cloudhopper.smpp.SmppSessionConfiguration in project load-balancer by RestComm.

the class BalancerDispatcher method bindRequested.

@Override
public void bindRequested(Long sessionId, ServerConnectionImpl serverConnection, Pdu packet) {
    // InvocationContext invocationContext = balancerRunner.getLatestInvocationContext();
    balancerRunner.balancerContext.smppRequestsToServer.getAndIncrement();
    balancerRunner.incMessages();
    balancerRunner.balancerContext.smppRequestsProcessedById.get(packet.getCommandId()).incrementAndGet();
    balancerRunner.balancerContext.smppBytesToServer.addAndGet(packet.getCommandLength());
    serverSessions.put(sessionId, serverConnection);
    SmppSessionConfiguration sessionConfig = serverConnection.getConfig();
    if (!serverConnection.getConfig().isUseSsl())
        sessionConfig.setUseSsl(false);
    else
        sessionConfig.setUseSsl(!balancerRunner.balancerContext.terminateTLSTraffic);
    counterConnections.compareAndSet(Integer.MAX_VALUE, 0);
    Node currNode = ctx.smppToProviderBalancerAlgorithm.processBindToProvider();
    sessionConfig.setHost(currNode.getIp());
    sessionConfig.setPort(Integer.parseInt((String) currNode.getProperties().get("smppPort")));
    clientSessions.put(sessionId, new ClientConnectionImpl(sessionId, sessionConfig, this, monitorExecutor, balancerRunner, packet, currNode));
    handlerService.execute(new BinderRunnable(sessionId, packet, serverSessions, clientSessions, currNode, balancerRunner));
}
Also used : SmppSessionConfiguration(com.cloudhopper.smpp.SmppSessionConfiguration) BinderRunnable(org.mobicents.tools.smpp.balancer.impl.BinderRunnable) Node(org.mobicents.tools.heartbeat.api.Node) ClientConnectionImpl(org.mobicents.tools.smpp.balancer.impl.ClientConnectionImpl)

Example 2 with SmppSessionConfiguration

use of com.cloudhopper.smpp.SmppSessionConfiguration in project load-balancer by RestComm.

the class MBinderRunnable method run.

@Override
public void run() {
    if (!cancelled) {
        SmppSessionConfiguration config = client.getConfig();
        config.setName("Loadbalancer");
        config.setHost(node.getIp());
        config.setPort(Integer.parseInt(node.getProperties().get("smppPort").toString()));
        config.setSystemId(systemId);
        config.setPassword(password);
        config.setSystemType(systemType);
        config.setUseSsl(isUseSsl);
        if (client.connect())
            client.bind();
    }
}
Also used : SmppSessionConfiguration(com.cloudhopper.smpp.SmppSessionConfiguration)

Example 3 with SmppSessionConfiguration

use of com.cloudhopper.smpp.SmppSessionConfiguration in project load-balancer by RestComm.

the class ConfigInit method getSmppSessionConfiguration.

static SmppSessionConfiguration getSmppSessionConfiguration(int i, boolean isSslClient) {
    SmppSessionConfiguration config = new SmppSessionConfiguration();
    config.setWindowSize(1);
    config.setName("Client " + i);
    config.setType(SmppBindType.TRANSCEIVER);
    config.setHost("127.0.0.1");
    config.setConnectTimeout(10000);
    config.setSystemId("RestComm");
    config.setPassword("password");
    config.getLoggingOptions().setLogBytes(true);
    // to enable monitoring (request expiration)
    config.setRequestExpiryTimeout(30000);
    config.setWindowMonitorInterval(15000);
    config.setCountersEnabled(true);
    if (isSslClient) {
        config.setPort(2876);
        SslConfiguration sslConfig = new SslConfiguration();
        sslConfig.setTrustAll(true);
        sslConfig.setValidateCerts(true);
        sslConfig.setValidatePeerCerts(true);
        config.setSslConfiguration(sslConfig);
        config.setUseSsl(true);
    } else {
        config.setPort(2776);
    }
    return config;
}
Also used : SmppSessionConfiguration(com.cloudhopper.smpp.SmppSessionConfiguration) SslConfiguration(com.cloudhopper.smpp.ssl.SslConfiguration)

Aggregations

SmppSessionConfiguration (com.cloudhopper.smpp.SmppSessionConfiguration)3 SslConfiguration (com.cloudhopper.smpp.ssl.SslConfiguration)1 Node (org.mobicents.tools.heartbeat.api.Node)1 BinderRunnable (org.mobicents.tools.smpp.balancer.impl.BinderRunnable)1 ClientConnectionImpl (org.mobicents.tools.smpp.balancer.impl.ClientConnectionImpl)1