Search in sources :

Example 1 with MessageUpdateFields

use of com.microsoft.azure.storage.queue.MessageUpdateFields in project camel by apache.

the class QueueServiceProducer method updateMessage.

private void updateMessage(Exchange exchange) throws Exception {
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    CloudQueueMessage message = getCloudQueueMessage(exchange);
    LOG.trace("Updating the message in the queue [{}] from exchange [{}]...", getConfiguration().getQueueName(), exchange);
    EnumSet<MessageUpdateFields> fields = null;
    Object fieldsObject = exchange.getIn().getHeader(QueueServiceConstants.MESSAGE_UPDATE_FIELDS);
    if (fieldsObject instanceof EnumSet) {
        @SuppressWarnings("unchecked") EnumSet<MessageUpdateFields> theFields = (EnumSet<MessageUpdateFields>) fieldsObject;
        fields = theFields;
    } else if (fieldsObject instanceof MessageUpdateFields) {
        fields = EnumSet.of((MessageUpdateFields) fieldsObject);
    }
    client.updateMessage(message, getConfiguration().getMessageVisibilityDelay(), fields, opts.getRequestOpts(), opts.getOpContext());
}
Also used : EnumSet(java.util.EnumSet) CloudQueueMessage(com.microsoft.azure.storage.queue.CloudQueueMessage) MessageUpdateFields(com.microsoft.azure.storage.queue.MessageUpdateFields) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Aggregations

CloudQueue (com.microsoft.azure.storage.queue.CloudQueue)1 CloudQueueMessage (com.microsoft.azure.storage.queue.CloudQueueMessage)1 MessageUpdateFields (com.microsoft.azure.storage.queue.MessageUpdateFields)1 EnumSet (java.util.EnumSet)1