Search in sources :

Example 1 with MessageType

use of org.apache.camel.component.apns.model.MessageType in project camel by apache.

the class ApnsProducer method notify.

private void notify(Exchange exchange) throws ApnsException {
    MessageType messageType = getHeaderMessageType(exchange, MessageType.STRING);
    if (messageType == MessageType.APNS_NOTIFICATION) {
        ApnsNotification apnsNotification = exchange.getIn().getBody(ApnsNotification.class);
        getEndpoint().getApnsService().push(apnsNotification);
    } else {
        constructNotificationAndNotify(exchange, messageType);
    }
}
Also used : ApnsNotification(com.notnoop.apns.ApnsNotification) MessageType(org.apache.camel.component.apns.model.MessageType)

Example 2 with MessageType

use of org.apache.camel.component.apns.model.MessageType in project camel by apache.

the class ApnsProducer method getHeaderMessageType.

public MessageType getHeaderMessageType(Exchange exchange, MessageType defaultMessageType) {
    String messageTypeStr = (String) exchange.getIn().getHeader(ApnsConstants.HEADER_MESSAGE_TYPE);
    if (messageTypeStr == null) {
        return defaultMessageType;
    }
    MessageType messageType = MessageType.valueOf(messageTypeStr);
    return messageType;
}
Also used : MessageType(org.apache.camel.component.apns.model.MessageType)

Aggregations

MessageType (org.apache.camel.component.apns.model.MessageType)2 ApnsNotification (com.notnoop.apns.ApnsNotification)1