Search in sources :

Example 1 with ProcessRequestException

use of org.jsmpp.extra.ProcessRequestException in project camel by apache.

the class MessageReceiverListenerImpl method onAcceptDataSm.

public DataSmResult onAcceptDataSm(DataSm dataSm, Session session) throws ProcessRequestException {
    LOG.debug("Received a dataSm {}", dataSm);
    MessageId newMessageId = messageIDGenerator.newMessageId();
    Exchange exchange = endpoint.createOnAcceptDataSm(dataSm, newMessageId.getValue());
    try {
        processor.process(exchange);
    } catch (Exception e) {
        exchange.setException(e);
    }
    if (exchange.getException() != null) {
        ProcessRequestException pre = exchange.getException(ProcessRequestException.class);
        if (pre == null) {
            pre = new ProcessRequestException(exchange.getException().getMessage(), 255, exchange.getException());
        }
        throw pre;
    }
    return new DataSmResult(newMessageId, dataSm.getOptionalParameters());
}
Also used : Exchange(org.apache.camel.Exchange) DataSmResult(org.jsmpp.session.DataSmResult) ProcessRequestException(org.jsmpp.extra.ProcessRequestException) ProcessRequestException(org.jsmpp.extra.ProcessRequestException) MessageId(org.jsmpp.util.MessageId)

Example 2 with ProcessRequestException

use of org.jsmpp.extra.ProcessRequestException in project camel by apache.

the class MessageReceiverListenerImpl method onAcceptDeliverSm.

public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException {
    LOG.debug("Received a deliverSm {}", deliverSm);
    Exchange exchange;
    try {
        exchange = endpoint.createOnAcceptDeliverSmExchange(deliverSm);
    } catch (Exception e) {
        exceptionHandler.handleException("Cannot create exchange. This exception will be ignored.", e);
        return;
    }
    try {
        processor.process(exchange);
    } catch (Exception e) {
        exchange.setException(e);
    }
    if (exchange.getException() != null) {
        ProcessRequestException pre = exchange.getException(ProcessRequestException.class);
        if (pre == null) {
            pre = new ProcessRequestException(exchange.getException().getMessage(), 255, exchange.getException());
        }
        throw pre;
    }
}
Also used : Exchange(org.apache.camel.Exchange) ProcessRequestException(org.jsmpp.extra.ProcessRequestException) ProcessRequestException(org.jsmpp.extra.ProcessRequestException)

Aggregations

Exchange (org.apache.camel.Exchange)2 ProcessRequestException (org.jsmpp.extra.ProcessRequestException)2 DataSmResult (org.jsmpp.session.DataSmResult)1 MessageId (org.jsmpp.util.MessageId)1