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);
}
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);
}
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());
}
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);
}
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;
}
Aggregations