Search in sources :

Example 1 with ServiceException

use of com.consol.citrus.samples.incident.exception.ServiceException in project citrus-samples by christophd.

the class FieldForceJmsConsumer method onMessage.

@Override
public void onMessage(Message message) {
    try {
        if (message instanceof TextMessage) {
            OrderNotification notification = (OrderNotification) unmarshaller.unmarshal(new StringSource(((TextMessage) message).getText()));
            fieldForceService.process(notification);
        }
    } catch (JMSException e) {
        throw new ServiceException("Failed to convert field force notification message", e);
    } catch (IOException e) {
        throw new ServiceException("Failed to read field force notification message", e);
    }
}
Also used : ServiceException(com.consol.citrus.samples.incident.exception.ServiceException) StringSource(org.springframework.xml.transform.StringSource) IOException(java.io.IOException) OrderNotification(org.citrusframework.schema.samples.fieldforceservice.v1.OrderNotification)

Aggregations

ServiceException (com.consol.citrus.samples.incident.exception.ServiceException)1 IOException (java.io.IOException)1 OrderNotification (org.citrusframework.schema.samples.fieldforceservice.v1.OrderNotification)1 StringSource (org.springframework.xml.transform.StringSource)1