use of org.jsmpp.session.SMPPSession in project camel by apache.
the class SmppBindingTest method createSmppReplaceSmCommand.
@Test
public void createSmppReplaceSmCommand() {
SMPPSession session = new SMPPSession();
Exchange exchange = new DefaultExchange(new DefaultCamelContext());
exchange.getIn().setHeader(SmppConstants.COMMAND, "ReplaceSm");
SmppCommand command = binding.createSmppCommand(session, exchange);
assertTrue(command instanceof SmppReplaceSmCommand);
}
use of org.jsmpp.session.SMPPSession in project camel by apache.
the class SmppBindingTest method createSmppQuerySmCommand.
@Test
public void createSmppQuerySmCommand() {
SMPPSession session = new SMPPSession();
Exchange exchange = new DefaultExchange(new DefaultCamelContext());
exchange.getIn().setHeader(SmppConstants.COMMAND, "QuerySm");
SmppCommand command = binding.createSmppCommand(session, exchange);
assertTrue(command instanceof SmppQuerySmCommand);
}
use of org.jsmpp.session.SMPPSession in project dhis2-core by dhis2.
the class SMPPClient method start.
private SMPPSession start(SMPPGatewayConfig config) {
try {
SMPPSession session = new SMPPSession(config.getUrlTemplate(), config.getPort(), getBindParameters(config));
log.info("SMPP client connected to SMSC: " + config.getUrlTemplate());
return session;
} catch (IOException e) {
log.error("I/O error occured", e);
}
return null;
}
use of org.jsmpp.session.SMPPSession in project dhis2-core by dhis2.
the class SMPPClient method sendBatch.
public List<OutboundMessageResponse> sendBatch(OutboundMessageBatch batch, SMPPGatewayConfig config) {
SMPPSession session = start(config);
if (session == null) {
return Collections.emptyList();
}
List<OutboundMessageResponse> responses = new ArrayList<>();
for (OutboundMessage message : batch.getMessages()) {
OutboundMessageResponse response = send(session, message.getText(), message.getRecipients(), config);
responses.add(response);
}
stop(session);
return responses;
}
use of org.jsmpp.session.SMPPSession in project dhis2-core by dhis2.
the class SMPPClient method send.
public OutboundMessageResponse send(String text, Set<String> recipients, SMPPGatewayConfig config) {
SMPPSession session = start(config);
if (session == null) {
return new OutboundMessageResponse(SESSION_ERROR, GatewayResponse.SMPP_SESSION_FAILURE, false);
}
OutboundMessageResponse response = send(session, text, recipients, config);
stop(session);
return response;
}
Aggregations