Search in sources :

Example 16 with CloudQueue

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

the class QueueServiceProducer method deleteMessage.

private void deleteMessage(Exchange exchange) throws Exception {
    LOG.trace("Deleting the message from the queue [{}] from exchange [{}]...", getConfiguration().getQueueName(), exchange);
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    CloudQueueMessage message = getCloudQueueMessage(exchange);
    client.deleteMessage(message, opts.getRequestOpts(), opts.getOpContext());
}
Also used : CloudQueueMessage(com.microsoft.azure.storage.queue.CloudQueueMessage) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 17 with CloudQueue

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

the class QueueServiceProducer method deleteQueue.

private void deleteQueue(Exchange exchange) throws Exception {
    LOG.trace("Deleting the queue [{}] from exchange [{}]...", getConfiguration().getQueueName(), exchange);
    CloudQueue client = QueueServiceUtil.createQueueClient(getConfiguration());
    QueueServiceRequestOptions opts = QueueServiceUtil.getRequestOptions(exchange);
    client.delete(opts.getRequestOpts(), opts.getOpContext());
}
Also used : CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 18 with CloudQueue

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

the class QueueServiceUtil method retrieveMessage.

public static void retrieveMessage(Exchange exchange, QueueServiceConfiguration cfg) throws Exception {
    CloudQueue client = createQueueClient(cfg);
    QueueServiceRequestOptions opts = getRequestOptions(exchange);
    CloudQueueMessage message = client.retrieveMessage(cfg.getMessageVisibilityDelay(), 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 19 with CloudQueue

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

the class QueueServiceComponentConfigurationTest method testCreateEndpointWithMinConfigForClientOnly.

@Test
public void testCreateEndpointWithMinConfigForClientOnly() throws Exception {
    CloudQueue client = new CloudQueue(URI.create("https://camelazure.queue.core.windows.net/testqueue/messages"), newAccountKeyCredentials());
    JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
    registry.bind("azureQueueClient", client);
    QueueServiceComponent component = new QueueServiceComponent(context);
    QueueServiceEndpoint endpoint = (QueueServiceEndpoint) component.createEndpoint("azure-queue://camelazure/testqueue?azureQueueClient=#azureQueueClient");
    doTestCreateEndpointWithMinConfig(endpoint, true);
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue) Test(org.junit.Test)

Example 20 with CloudQueue

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

the class QueueServiceUtilTest method testGetConfiguredClient.

@Test
public void testGetConfiguredClient() throws Exception {
    CloudQueue client = new CloudQueue(URI.create("https://camelazure.queue.core.windows.net/testqueue/messages"), newAccountKeyCredentials());
    JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
    registry.bind("azureQueueClient", client);
    QueueServiceComponent component = new QueueServiceComponent(context);
    QueueServiceEndpoint endpoint = (QueueServiceEndpoint) component.createEndpoint("azure-queue://camelazure/testqueue?azureQueueClient=#azureQueueClient");
    assertSame(client, QueueServiceUtil.getConfiguredClient(endpoint.getConfiguration()));
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue) Test(org.junit.Test)

Aggregations

CloudQueue (com.microsoft.azure.storage.queue.CloudQueue)20 CloudQueueMessage (com.microsoft.azure.storage.queue.CloudQueueMessage)8 CloudQueueClient (com.microsoft.azure.storage.queue.CloudQueueClient)7 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)7 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)4 JndiRegistry (org.apache.camel.impl.JndiRegistry)3 Test (org.junit.Test)3 StorageCredentials (com.microsoft.azure.storage.StorageCredentials)2 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 Queue (com.microsoft.tooling.msservices.model.storage.Queue)1 URI (java.net.URI)1 EnumSet (java.util.EnumSet)1