I cannot understand the comments in the examples and the code
Creates a new default SmppClient.
@param workerGroup The max number of concurrent sessions expected
to be active at any time. This number controls the max number of worker
threads that the underlying Netty library will use. If processing
occurs in a sessionHandler (a blocking op), be VERY careful
setting this to the correct number of concurrent sessions you expect.
If I want to connect to a SMSC over 5 binds (smpp sessions) what I am doing is this:
public void configure(MessageForwardingService messageForwardingService,
MessageLoggingService messageLoggingService) {
int sessionNum = connectionProperties.get(ConnectionConstants.OPERATOR_CONNECTION_SESSION_NUMBER, 0);
final SmppClientMessageService smppClientMessageService = new CommXPSmppClientMessageService(operatorName,
messageForwardingService, messageLoggingService, applicationEventPublisher);
for (int i = 0; i < sessionNum; i++) {
OutboundClient client = new OutboundClient(
connectionProperties.get(ConnectionConstants.OPERATOR_CONNECTION_ENQUIRELINK_TIMER, 10000),
connectionProperties.get(ConnectionConstants.OPERATOR_CONNECTION_ENQUIRELINK_TIMER, 30000));
client.initialize(getSmppConnectionConfiguration(i), smppClientMessageService);
balancedList.set(client, 1);
}
}
public OutboundClient(final Integer endquireLinkPeriod, Integer enquireLinkTimeout) {
this.enquireLinkPeriod = endquireLinkPeriod;
this.enquireLinkTimeout = enquireLinkTimeout;
this.enquireLinkExecutor = Executors.newScheduledThreadPool(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
String name = config.getName();
t.setName("EnquireLink-" + name);
return t;
}
});
monitorExecutor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1, new ThreadFactory() {
private AtomicInteger sequence = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setName("SmppClientSessionWindowMonitorPool-" + sequence.getAndIncrement());
return t;
}
});
NioEventLoopGroup group = new NioEventLoopGroup(1);
clientBootstrap = new DefaultSmppClient(group, monitorExecutor);
}
public void initialize(SmppSessionConfiguration config, SmppClientMessageService smppClientMessageService) {
this.config = config;
logger = LoggerFactory.getLogger(OutboundClient.class.getCanonicalName() + config.getName());
//
// setup configuration for a client session
//
sessionHandler = new ClientSmppSessionHandler(this, smppClientMessageService);
}`
Then I get each of the balancedList sessions and I submitMessages.
To my mind this is creating 5 different DefaultClients with 1 thread each. Somehow though this seems counter intuitive and I am not sure it is correct.
It works and I had great success submitting with over 200 TPS but I am worried since I started facing an issue with very heavy load for incoming messages. Is the problem related to using the sessions incorrectly or should I look elsewhere for the issue?
I know that opening an issue might not be ideal but given the limited documentation I have found on cloudhopper I thought this could be a good opportunity to add some explanation to the code samples.
I cannot understand the comments in the examples and the code
If I want to connect to a SMSC over 5 binds (smpp sessions) what I am doing is this:
Then I get each of the balancedList sessions and I submitMessages.
To my mind this is creating 5 different DefaultClients with 1 thread each. Somehow though this seems counter intuitive and I am not sure it is correct.
It works and I had great success submitting with over 200 TPS but I am worried since I started facing an issue with very heavy load for incoming messages. Is the problem related to using the sessions incorrectly or should I look elsewhere for the issue?
I know that opening an issue might not be ideal but given the limited documentation I have found on cloudhopper I thought this could be a good opportunity to add some explanation to the code samples.