Azure Storage Queue Service
Since Camel 3.3
Both producer and consumer are supported
The Azure Storage Queue component supports storing and retrieving the messages to/from Azure Storage Queue service using Azure APIs v12. However, in the case of versions above v12, we will see if this component can adopt these changes depending on how much breaking changes can result.
Prerequisites
You must have a valid Windows Azure Storage account. More information is available at Azure Documentation Portal.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-azure-storage-queue</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency> URI Format
azure-storage-queue://accountName[/queueName][?options] In the case of consumer, accountName and queueName are required.
In the case of producer, it depends on the operation that being requested, for example, if operation is on a service level, e.b: listQueues, only accountName is required, but in the case of operation being requested on the queue level, e.g.: createQueue, `sendMessage, etc., both accountName and queueName are required.
The queue will be created if it does not already exist. You can append query options to the URI in the following format: ?options=value&option2=value&…
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Azure Storage Queue Service component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The configuration that each endpoint of the component starts from, as a copy. The options of the endpoint replace its values. | QueueConfiguration | ||
How the client authenticates when serviceClient is not set. SHARED_ACCOUNT_KEY and SHARED_KEY_CREDENTIAL both use the credentials option if it is set, and otherwise accountName and accessKey. AZURE_IDENTITY uses the DefaultAzureCredential of azure-identity, which takes the identity from environment variables, a managed identity or a developer tool login. If not set, SHARED_KEY_CREDENTIAL is used when credentials is set, and otherwise SHARED_ACCOUNT_KEY. Enum values:
| SHARED_ACCOUNT_KEY | CredentialType | |
Autowired To use a custom com.azure.storage.queue.QueueServiceClient for the requests to the queue service. When this option is set or autowired, the client brings the address and the authentication, and the accountName, credentialType, accessKey and credentials options are not used to connect. | QueueServiceClient | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether sendMessage first creates the queue if it does not exist, with the metadata of the CamelAzureStorageQueueMetadata header. The CamelAzureStorageQueueCreateQueue header replaces this option. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The operation that the producer performs. The CamelAzureStorageQueueOperation header replaces this option. If neither is set, the producer performs sendMessage. Enum values:
| QueueOperationDefinition | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
Used for enabling or disabling all consumer based health checks from this component. | true | boolean | |
Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true. | true | boolean | |
The maximum number of messages to receive, from 1 to 32: in each poll of the consumer, and for receiveMessages and peekMessages. The CamelAzureStorageQueueMaxMessages header replaces this option for the producer. | 1 | Integer | |
The ID of the message that deleteMessage or updateMessage changes. The CamelAzureStorageQueueMessageId header, which the consumer and sendMessage set, replaces this option. | String | ||
The pop receipt of the message that deleteMessage or updateMessage changes, which must be the latest pop receipt of that message. The CamelAzureStorageQueuePopReceipt header, which the consumer, sendMessage and updateMessage set to the pop receipt they get, replaces this option. | String | ||
The time, for example PT10S or 10s, within which each request of the producer and the consumer to the queue service must complete, or it fails with an exception. If not set, only the timeouts of the HTTP client apply. The CamelAzureStorageQueueTimeout header replaces this option for the producer. | Duration | ||
How long the message that sendMessage sends stays in the queue, for example P2D or 12h, in whole seconds. If not set, the queue service keeps it for 7 days, and PT-1S keeps it until it is deleted. The CamelAzureStorageQueueTimeToLive header replaces this option. | Duration | ||
How long a message stays invisible in the queue, for example PT30S or 30s, in whole seconds and at most 7 days. sendMessage hides the message it sends for this long, or not at all if not set, and updateMessage, which requires it, hides the message for this long from the update. receiveMessages and the consumer hide each message they receive for this long, or 30 seconds if not set, and the consumer receives a message again after this time if its exchange failed. The CamelAzureStorageQueueVisibilityTimeout header replaces this option for the producer. | Duration | ||
The account key of the storage account, which authenticates the client together with accountName when credentialType is SHARED_ACCOUNT_KEY or SHARED_KEY_CREDENTIAL. Not used when the credentials option or the serviceClient option is set. | String | ||
Autowired To use a com.azure.storage.common.StorageSharedKeyCredential, which holds the account name and an account key of the storage account, when credentialType is SHARED_KEY_CREDENTIAL or SHARED_ACCOUNT_KEY. When it is set, the accountName and accessKey options are not used to authenticate. Not used when serviceClient is set. | StorageSharedKeyCredential |
Endpoint Options
The Azure Storage Queue Service endpoint is configured using URI syntax:
azure-storage-queue:accountName/queueName
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The name of the Azure Storage account, which gives the address https://accountName.queue.core.windows.net of its queue service. If the credentials option is set, the account name of those credentials gives the address instead. Not used when serviceClient is set. | String | ||
The name of the queue. Required for the consumer and for each producer operation except listQueues. The CamelAzureStorageQueueName header replaces this option for the producer. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
How the client authenticates when serviceClient is not set. SHARED_ACCOUNT_KEY and SHARED_KEY_CREDENTIAL both use the credentials option if it is set, and otherwise accountName and accessKey. AZURE_IDENTITY uses the DefaultAzureCredential of azure-identity, which takes the identity from environment variables, a managed identity or a developer tool login. If not set, SHARED_KEY_CREDENTIAL is used when credentials is set, and otherwise SHARED_ACCOUNT_KEY. Enum values:
| SHARED_ACCOUNT_KEY | CredentialType | |
Autowired To use a custom com.azure.storage.queue.QueueServiceClient for the requests to the queue service. When this option is set or autowired, the client brings the address and the authentication, and the accountName, credentialType, accessKey and credentials options are not used to connect. | QueueServiceClient | ||
If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | PollingConsumerPollStrategy | ||
Whether sendMessage first creates the queue if it does not exist, with the metadata of the CamelAzureStorageQueueMetadata header. The CamelAzureStorageQueueCreateQueue header replaces this option. | false | boolean | |
The operation that the producer performs. The CamelAzureStorageQueueOperation header replaces this option. If neither is set, the producer performs sendMessage. Enum values:
| QueueOperationDefinition | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The maximum number of messages to receive, from 1 to 32: in each poll of the consumer, and for receiveMessages and peekMessages. The CamelAzureStorageQueueMaxMessages header replaces this option for the producer. | 1 | Integer | |
The ID of the message that deleteMessage or updateMessage changes. The CamelAzureStorageQueueMessageId header, which the consumer and sendMessage set, replaces this option. | String | ||
The pop receipt of the message that deleteMessage or updateMessage changes, which must be the latest pop receipt of that message. The CamelAzureStorageQueuePopReceipt header, which the consumer, sendMessage and updateMessage set to the pop receipt they get, replaces this option. | String | ||
The time, for example PT10S or 10s, within which each request of the producer and the consumer to the queue service must complete, or it fails with an exception. If not set, only the timeouts of the HTTP client apply. The CamelAzureStorageQueueTimeout header replaces this option for the producer. | Duration | ||
How long the message that sendMessage sends stays in the queue, for example P2D or 12h, in whole seconds. If not set, the queue service keeps it for 7 days, and PT-1S keeps it until it is deleted. The CamelAzureStorageQueueTimeToLive header replaces this option. | Duration | ||
How long a message stays invisible in the queue, for example PT30S or 30s, in whole seconds and at most 7 days. sendMessage hides the message it sends for this long, or not at all if not set, and updateMessage, which requires it, hides the message for this long from the update. receiveMessages and the consumer hide each message they receive for this long, or 30 seconds if not set, and the consumer receives a message again after this time if its exchange failed. The CamelAzureStorageQueueVisibilityTimeout header replaces this option for the producer. | Duration | ||
The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | int | ||
The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | int | ||
To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | int | ||
Milliseconds before the next poll. | 500 | long | |
If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean | |
How long a poll may run before the health check of the consumer reports DOWN. The health check is otherwise based on the polls that are done, so it stays UP while a poll hangs, for example on a read without timeout from a connection that went silent. A poll includes routing the messages it polled, so set this above the longest poll you expect. The poll is not interrupted. The value is in millis (not affected by timeUnit). The default 0 turns this off. | 0 | long | |
Milliseconds before the first poll starts. | 1000 | long | |
Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. | 0 | long | |
The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. Enum values:
| TRACE | LoggingLevel | |
Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | ScheduledExecutorService | ||
To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler. | none | Object | |
To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. This is a multi-value option with prefix: scheduler. | Map | ||
Whether the scheduler should be auto started. | true | boolean | |
Time unit for initialDelay and delay options. Enum values:
| MILLISECONDS | TimeUnit | |
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean | |
The account key of the storage account, which authenticates the client together with accountName when credentialType is SHARED_ACCOUNT_KEY or SHARED_KEY_CREDENTIAL. Not used when the credentials option or the serviceClient option is set. | String | ||
Autowired To use a com.azure.storage.common.StorageSharedKeyCredential, which holds the account name and an account key of the storage account, when credentialType is SHARED_KEY_CREDENTIAL or SHARED_ACCOUNT_KEY. When it is set, the accountName and accessKey options are not used to authenticate. Not used when serviceClient is set. | StorageSharedKeyCredential |
Message Headers
The Azure Storage Queue Service component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelAzureStorageQueueRawHttpHeaders (common) Constant: | The HTTP headers of the response of the queue service, as a com.azure.core.http.HttpHeaders. The producer sets it for each operation except listQueues, receiveMessages and peekMessages. | HttpHeaders | |
CamelAzureStorageQueueMetadata (producer) Constant: | The metadata of the queue that createQueue creates, or that sendMessage creates when createQueue is true. sendMessage does not change the metadata of a queue that already exists. | Map | |
CamelAzureStorageQueueMessageId (common) Constant: | The ID of the message. The consumer sets it for each message it receives, and sendMessage for the message it sends. It replaces the messageId option for deleteMessage and updateMessage. | String | |
CamelAzureStorageQueueInsertionTime (common) Constant: | The time the message was added to the queue. The consumer and sendMessage set it. | OffsetDateTime | |
CamelAzureStorageQueueExpirationTime (common) Constant: | The time the message expires and the queue service deletes it. The consumer and sendMessage set it. | OffsetDateTime | |
CamelAzureStorageQueuePopReceipt (producer) Constant: | The pop receipt of the message, which deleteMessage and updateMessage need, and which is no longer valid once the message is received again or updated. The consumer, sendMessage and updateMessage set it to the pop receipt they get. It replaces the popReceipt option for deleteMessage and updateMessage. | String | |
CamelAzureStorageQueueTimeNextVisible (common) Constant: | The time the message becomes visible in the queue again. The consumer, sendMessage and updateMessage set it. | OffsetDateTime | |
CamelAzureStorageQueueDequeueCount (common) Constant: | The number of times the message has been received from the queue, this time included. The consumer sets it. | long | |
CamelAzureStorageQueueConsumedQueueName (consumer) Constant: | The name of the queue the message was received from. It is not the CamelAzureStorageQueueName header, which overrides the queue of a producer. | String | |
CamelAzureStorageQueueOperation (producer) Constant: | The operation that the producer performs. It replaces the operation option. Enum values:
| QueueOperationDefinition | |
CamelAzureStorageQueueName (producer) Constant: | The name of the queue for the producer. It replaces the queueName option. | String | |
CamelAzureStorageQueueSegmentOptions (producer) Constant: | The options of listQueues: the prefix of the names of the queues to list, whether to include the metadata of each queue, and the number of queues per page. If not set, listQueues lists all queues without their metadata. | QueuesSegmentOptions | |
CamelAzureStorageQueueTimeout (producer) Constant: | The time within which each request of the producer to the queue service must complete, or it fails with an exception. It replaces the timeout option. | Duration | |
CamelAzureStorageQueueMaxMessages (producer) Constant: | The maximum number of messages that receiveMessages or peekMessages returns, from 1 to 32. It replaces the maxMessages option. | Integer | |
CamelAzureStorageQueueVisibilityTimeout (producer) Constant: | How long the message stays invisible in the queue, at most 7 days: the message that sendMessage sends, each message that receiveMessages receives, or the message that updateMessage updates, for which it is required. It replaces the visibilityTimeout option. | Duration | |
CamelAzureStorageQueueTimeToLive (producer) Constant: | How long the message that sendMessage sends stays in the queue, where PT-1S keeps it until it is deleted. It replaces the timeToLive option. | Duration | |
CamelAzureStorageQueueCreateQueue (producer) Constant: | Whether sendMessage first creates the queue if it does not exist. It replaces the createQueue option. | boolean |
Message Body
The message body at each side of the Azure Storage Queue Service component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| The text of the queue message as a stream, with its id and pop receipt in headers; no body for a message without text. |
Producer input |
| The text of the message for sendMessage, the default, and updateMessage: bytes, a stream or a file are read as text, and a Map or a POJO is sent as its toString(): marshal it first. sendMessage fails without a body, and updateMessage then changes only the visibility. The other operations do not use the body.
|
Producer output |
| true after sendMessage, the default, and the operations that create, clear, update or delete, with their results in headers, such as the id and the pop receipt of the message sent. A List of the items of the SDK for listQueues, receiveMessages and peekMessages.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Required information options:
Required information options:
To use this component, you have multiple options to provide the required Azure authentication information:
-
By providing your own QueueServiceClient instance which can be injected into
serviceClient. -
Via Azure Identity, when specifying
credentialType=AZURE_IDENTITYand providing required environment variables. This enables service principal (e.g. app registration) authentication with secret/certificate as well as username password. -
Via shared storage account key, when specifying
credentialType=SHARED_ACCOUNT_KEYand providingaccountNameandaccessKeyfor your Azure account, this is the simplest way to get started. The accessKey can be generated through your Azure portal. Note that this is the default authentication strategy. -
Via shared storage account key, when specifying
credentialType=SHARED_KEY_CREDENTIALand providing a StorageSharedKeyCredential instance which can be injected intocredentialsoption.
Usage
For example, to get a message content from the queue messageQueue in the storageAccount storage account and, use the following snippet:
-
Java
-
XML
-
YAML
from("azure-storage-queue://storageAccount/messageQueue?accessKey=yourAccessKey")
.to("file://queuedirectory"); <route>
<from uri="azure-storage-queue://storageAccount/messageQueue?accessKey=yourAccessKey"/>
<to uri="file://queuedirectory"/>
</route> - route:
from:
uri: azure-storage-queue://storageAccount/messageQueue
parameters:
accessKey: yourAccessKey
steps:
- to:
uri: file://queuedirectory Advanced Azure Storage Queue configuration
If your Camel Application is running behind a firewall or if you need to have more control over the QueueServiceClient instance configuration, you can create your own instance:
StorageSharedKeyCredential credential = new StorageSharedKeyCredential("yourAccountName", "yourAccessKey");
String uri = String.format("https://%s.queue.core.windows.net", "yourAccountName");
QueueServiceClient client = new QueueServiceClientBuilder()
.endpoint(uri)
.credential(credential)
.buildClient();
// This is camel context
context.getRegistry().bind("client", client); Then refer to this instance in your Camel azure-storage-queue component configuration:
-
Java
-
XML
-
YAML
from("azure-storage-queue://cameldev/queue1?serviceClient=#client")
.to("file://outputFolder?fileName=output.txt&fileExist=Append"); <route>
<from uri="azure-storage-queue://cameldev/queue1?serviceClient=#client"/>
<to uri="file://outputFolder?fileName=output.txt&fileExist=Append"/>
</route> - route:
from:
uri: azure-storage-queue://cameldev/queue1
parameters:
serviceClient: "#client"
steps:
- to:
uri: file://outputFolder
parameters:
fileName: output.txt
fileExist: Append Automatic detection of QueueServiceClient client in registry
The component is capable of detecting the presence of an QueueServiceClient bean into the registry. If it’s the only instance of that type, it will be used as the client, and you won’t have to define it as uri parameter, like the example above. This may be really useful for smarter configuration of the endpoint.
Azure Storage Queue Producer operations
Camel Azure Storage Queue component provides a wide range of operations on the producer side:
Operations on the service level
For these operations, accountName is required.
| Operation | Description |
|---|---|
| Lists the queues in the storage account that pass the filter starting at the specified marker. |
Operations on the queue level
For these operations, accountName and queueName are required.
| Operation | Description |
|---|---|
| Creates a new queue. |
| Permanently deletes the queue. |
| Deletes all messages in the queue.. |
| Default Producer Operation Sends a message with a given time-to-live and timeout period where the message is invisible in the queue. The message text is evaluated from the exchange message body; without a body the operation fails with an |
| Deletes the specified message in the queue. |
| Retrieves up to the maximum number of messages from the queue and hides them from other operations for the timeout period. However, it will not dequeue the message from the queue due to reliability reasons. |
| Peek messages from the front of the queue up to the maximum number of messages. |
| Updates the specific message in the queue with a new message and resets the visibility timeout. The message text is evaluated from the exchange message body. |
Refer to the example section in this page to learn how to use these operations into your camel application.
Examples
Consumer Examples
To consume a queue into a file component with maximum five messages in one batch, this can be done like this:
-
Java
-
XML
-
YAML
from("azure-storage-queue://cameldev/queue1?serviceClient=#client&maxMessages=5")
.to("file://outputFolder?fileName=output.txt&fileExist=Append"); <route>
<from uri="azure-storage-queue://cameldev/queue1?serviceClient=#client&maxMessages=5"/>
<to uri="file://outputFolder?fileName=output.txt&fileExist=Append"/>
</route> - route:
from:
uri: azure-storage-queue://cameldev/queue1
parameters:
serviceClient: "#client"
maxMessages: 5
steps:
- to:
uri: file://outputFolder
parameters:
fileName: output.txt
fileExist: Append Producer Operations Examples
-
listQueues:
from("direct:start")
.process(exchange -> {
exchange.getIn().setHeader("CamelAzureStorageQueueSegmentOptions",
new QueuesSegmentOptions().setPrefix("awesome"));
})
.to("azure-storage-queue://cameldev?serviceClient=#client&operation=listQueues")
.log("${body}")
.to("mock:result"); -
createQueue:
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageQueueName", constant("overrideName"))
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=createQueue"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageQueueName">
<constant>overrideName</constant>
</setHeader>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=createQueue"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageQueueName
constant: overrideName
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: createQueue -
deleteQueue:
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageQueueName", constant("overrideName"))
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=deleteQueue"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageQueueName">
<constant>overrideName</constant>
</setHeader>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=deleteQueue"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageQueueName
constant: overrideName
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: deleteQueue -
clearQueue:
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageQueueName", constant("overrideName"))
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=clearQueue"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageQueueName">
<constant>overrideName</constant>
</setHeader>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=clearQueue"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageQueueName
constant: overrideName
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: clearQueue -
sendMessage:
-
Java
-
XML
-
YAML
from("direct:start")
.setBody(constant("message to send"))
.to("azure-storage-queue://cameldev/test?serviceClient=#client"); <route>
<from uri="direct:start"/>
<setBody>
<constant>message to send</constant>
</setBody>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client"/>
</route> - route:
from:
uri: direct:start
steps:
- setBody:
constant: message to send
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client" -
deleteMessage:
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelAzureStorageQueueMessageId", constant("1"))
.setHeader("CamelAzureStorageQueuePopReceipt", constant("PAAAAHEEERXXX-1"))
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=deleteMessage"); <route>
<from uri="direct:start"/>
<setHeader name="CamelAzureStorageQueueMessageId">
<constant>1</constant>
</setHeader>
<setHeader name="CamelAzureStorageQueuePopReceipt">
<constant>PAAAAHEEERXXX-1</constant>
</setHeader>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=deleteMessage"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelAzureStorageQueueMessageId
constant: "1"
- setHeader:
name: CamelAzureStorageQueuePopReceipt
constant: PAAAAHEEERXXX-1
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: deleteMessage -
receiveMessages:
-
Java
-
XML
-
YAML
from("direct:start")
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=receiveMessages")
.to("mock:result"); <route>
<from uri="direct:start"/>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=receiveMessages"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: receiveMessages
- to:
uri: mock:result -
peekMessages:
-
Java
-
XML
-
YAML
from("direct:start")
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=peekMessages")
.to("mock:result"); <route>
<from uri="direct:start"/>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=peekMessages"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: peekMessages
- to:
uri: mock:result -
updateMessage:
-
Java
-
XML
-
YAML
from("direct:start")
.setBody(constant("new message text"))
.setHeader("CamelAzureStorageQueueMessageId", constant("1"))
.setHeader("CamelAzureStorageQueuePopReceipt", constant("PAAAAHEEERXXX-1"))
.to("azure-storage-queue://cameldev/test?serviceClient=#client&operation=updateMessage"); <route>
<from uri="direct:start"/>
<setBody>
<constant>new message text</constant>
</setBody>
<setHeader name="CamelAzureStorageQueueMessageId">
<constant>1</constant>
</setHeader>
<setHeader name="CamelAzureStorageQueuePopReceipt">
<constant>PAAAAHEEERXXX-1</constant>
</setHeader>
<to uri="azure-storage-queue://cameldev/test?serviceClient=#client&operation=updateMessage"/>
</route> - route:
from:
uri: direct:start
steps:
- setBody:
constant: new message text
- setHeader:
name: CamelAzureStorageQueueMessageId
constant: "1"
- setHeader:
name: CamelAzureStorageQueuePopReceipt
constant: PAAAAHEEERXXX-1
- to:
uri: azure-storage-queue://cameldev/test
parameters:
serviceClient: "#client"
operation: updateMessage Important Development Notes
When developing on this component, you will need to obtain your Azure accessKey to run the integration tests. In addition to the mocked unit tests, you will need to run the integration tests with every change you make or even client upgrade as the Azure client can break things even on minor versions upgrade. To run the integration tests, on this component directory, run the following maven command:
mvn verify -DaccountName=myacc -DaccessKey=mykey Whereby accountName is your Azure account name and accessKey is the access key being generated from Azure portal.