Search in sources :

Example 36 with CloudQueue

use of com.microsoft.azure.storage.queue.CloudQueue in project azure-tools-for-java by Microsoft.

the class StorageClientSDKManager method createQueueMessage.

public void createQueueMessage(@NotNull StorageAccount storageAccount, @NotNull QueueMessage queueMessage, int timeToLiveInSeconds) throws AzureCmdException {
    try {
        CloudQueueClient client = getCloudQueueClient(storageAccount);
        CloudQueue cloudQueue = client.getQueueReference(queueMessage.getQueueName());
        cloudQueue.addMessage(new CloudQueueMessage(queueMessage.getContent()), timeToLiveInSeconds, 0, null, null);
    } catch (Throwable t) {
        throw new AzureCmdException("Error creating the Queue Message", t);
    }
}
Also used : CloudQueueClient(com.microsoft.azure.storage.queue.CloudQueueClient) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException) CloudQueueMessage(com.microsoft.azure.storage.queue.CloudQueueMessage) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 37 with CloudQueue

use of com.microsoft.azure.storage.queue.CloudQueue in project azure-tools-for-java by Microsoft.

the class StorageClientSDKManager method deleteQueue.

public void deleteQueue(@NotNull StorageAccount storageAccount, @NotNull Queue queue) throws AzureCmdException {
    try {
        CloudQueueClient client = getCloudQueueClient(storageAccount);
        CloudQueue cloudQueue = client.getQueueReference(queue.getName());
        cloudQueue.deleteIfExists();
    } catch (Throwable t) {
        throw new AzureCmdException("Error deleting the Queue", t);
    }
}
Also used : CloudQueueClient(com.microsoft.azure.storage.queue.CloudQueueClient) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException) 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