Search in sources :

Example 1 with CloudQueue

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

the class QueueServiceProducer method createQueue.

private void createQueue(Exchange exchange) throws Exception {
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    doCreateQueue(client, opts, exchange);
}
Also used : CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 2 with CloudQueue

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

the class QueueServiceProducer method listQueues.

private void listQueues(Exchange exchange) throws Exception {
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    QueueListingDetails details = (QueueListingDetails) exchange.getIn().getHeader(QueueServiceConstants.QUEUE_LISTING_DETAILS);
    if (details == null) {
        details = QueueListingDetails.ALL;
    }
    Iterable<CloudQueue> list = client.getServiceClient().listQueues(getConfiguration().getQueuePrefix(), details, opts.getRequestOpts(), opts.getOpContext());
    ExchangeUtil.getMessageForResponse(exchange).setBody(list);
}
Also used : QueueListingDetails(com.microsoft.azure.storage.queue.QueueListingDetails) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 3 with CloudQueue

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

the class QueueServiceProducer method addMessage.

private void addMessage(Exchange exchange) throws Exception {
    LOG.trace("Putting the message into the queue [{}] from exchange [{}]...", getConfiguration().getQueueName(), exchange);
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    Boolean queueCreated = exchange.getIn().getHeader(QueueServiceConstants.QUEUE_CREATED, Boolean.class);
    if (Boolean.TRUE != queueCreated) {
        doCreateQueue(client, opts, exchange);
    }
    CloudQueueMessage message = getCloudQueueMessage(exchange);
    client.addMessage(message, getConfiguration().getMessageTimeToLive(), getConfiguration().getMessageVisibilityDelay(), opts.getRequestOpts(), opts.getOpContext());
}
Also used : CloudQueueMessage(com.microsoft.azure.storage.queue.CloudQueueMessage) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 4 with CloudQueue

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

the class QueueServiceProducer method peekMessage.

private void peekMessage(Exchange exchange) throws Exception {
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    CloudQueueMessage message = client.peekMessage(opts.getRequestOpts(), opts.getOpContext());
    ExchangeUtil.getMessageForResponse(exchange).setBody(message);
}
Also used : CloudQueueMessage(com.microsoft.azure.storage.queue.CloudQueueMessage) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 5 with CloudQueue

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

the class QueueServiceUtil method createQueueClient.

public static CloudQueue createQueueClient(QueueServiceConfiguration cfg) throws Exception {
    CloudQueue client = (CloudQueue) getConfiguredClient(cfg);
    if (client == null) {
        URI uri = prepareStorageQueueUri(cfg);
        StorageCredentials creds = getAccountCredentials(cfg);
        client = new CloudQueue(uri, creds);
    }
    return client;
}
Also used : StorageCredentials(com.microsoft.azure.storage.StorageCredentials) URI(java.net.URI) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Aggregations

CloudQueue (com.microsoft.azure.storage.queue.CloudQueue)37 CloudQueueClient (com.microsoft.azure.storage.queue.CloudQueueClient)14 Test (org.junit.Test)13 CloudQueueMessage (com.microsoft.azure.storage.queue.CloudQueueMessage)9 IOException (java.io.IOException)9 URISyntaxException (java.net.URISyntaxException)9 InvalidKeyException (java.security.InvalidKeyException)9 ArrayList (java.util.ArrayList)9 Iterator (java.util.Iterator)9 AzureBaseTest (org.talend.components.azurestorage.AzureBaseTest)9 ValidationResult (org.talend.daikon.properties.ValidationResult)9 StorageException (com.microsoft.azure.storage.StorageException)7 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)7 URI (java.net.URI)7 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)4 StorageCredentials (com.microsoft.azure.storage.StorageCredentials)3 JndiRegistry (org.apache.camel.impl.JndiRegistry)3 QueueMessage (com.microsoft.tooling.msservices.model.storage.QueueMessage)2 MessageUpdateFields (com.microsoft.azure.storage.queue.MessageUpdateFields)1 QueueListingDetails (com.microsoft.azure.storage.queue.QueueListingDetails)1