Camel Spring Boot

Dapr

Invoke services, manage state, publish and subscribe to events, and use the bindings, secrets, configuration, locks and workflows of the Dapr building blocks through the Dapr sidecar.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-dapr-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 43 options, which are listed below.

Name Description Default Type

camel.component.dapr.allow-secret-store-and-key-from-headers

Whether to allow overriding the secret store, the key and the metadata of the endpoint with the CamelDaprSecretStore, CamelDaprKey and CamelDaprMetadata headers for the secret operation. Disabled by default; enable it only when the header source is trusted, since it lets a message choose the secret store and the secret that the secret operation reads.

false

Boolean

camel.component.dapr.autowired-enabled

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

camel.component.dapr.binding-name

The name of the Dapr output binding component to call with the invokeBinding operation.

String

camel.component.dapr.binding-operation

The operation of the output binding to call with the invokeBinding operation, such as create, get, delete or list. The supported operations depend on the binding component.

String

camel.component.dapr.bridge-error-handler

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

camel.component.dapr.client

The DaprClient for service invocation, state, publishing to pub/sub, bindings, secrets and configuration (also the configuration consumer). When not set, the endpoint builds one with DaprClientBuilder, which connects to the Dapr sidecar given by the Dapr properties, such as DAPR_SIDECAR_IP and DAPR_GRPC_PORT. The option is a io.dapr.client.DaprClient type.

DaprClient

camel.component.dapr.concurrency

The concurrency mode of the state save, get and delete operations: FIRST_WRITE (first-write-wins) or LAST_WRITE (last-write-wins). When not set, the state store applies its default, which is last-write-wins.

StateOptions$Concurrency

camel.component.dapr.config-keys

The keys of the configuration items to get (producer) or whose changes to receive (consumer) with the configuration operation, as a comma-separated list. Required for the configuration operation.

String

camel.component.dapr.config-store

The name of the Dapr configuration store component of the configuration operation, to get configuration items (producer) or to subscribe to their changes (consumer).

String

camel.component.dapr.configuration

The configuration shared by the endpoints of this component. The option is a org.apache.camel.component.dapr.DaprConfiguration type.

DaprConfiguration

camel.component.dapr.consistency

The consistency level of the state save, get and delete operations: EVENTUAL or STRONG. When not set, the state store applies its default, which is eventual consistency.

StateOptions$Consistency

camel.component.dapr.content-type

The content type of the event data that the pubSub producer publishes. When not set, the Dapr client uses the content type of its serializer, application/json by default.

String

camel.component.dapr.e-tag

The ETag of the value in the state store, for optimistic concurrency of the state save and delete operations: the state store applies the change only when the ETag matches the current ETag of the value.

String

camel.component.dapr.enabled

Whether to enable auto configuration of the dapr component. This is enabled by default.

Boolean

camel.component.dapr.event-name

The name of the event to send to the workflow instance with the raiseEvent workflow operation. Event names are case-insensitive.

String

camel.component.dapr.expiry-in-seconds

The time in seconds after which the lock expires, if not unlocked before. Required for the tryLock lock operation.

Integer

camel.component.dapr.get-workflow-i-o

Whether the state, waitForInstanceStart and waitForInstanceCompletion workflow operations also fetch the inputs, outputs and custom status of the workflow instance.

false

Boolean

camel.component.dapr.header-filter-strategy

To use a custom HeaderFilterStrategy to filter header to and from Camel message. The option is a org.apache.camel.spi.HeaderFilterStrategy type.

HeaderFilterStrategy

camel.component.dapr.http-extension

The HttpExtension (HTTP method, query parameters and HTTP headers) of the invokeService operation. A text value is converted to the HttpExtension constant of that HTTP method, without query parameters or HTTP headers: GET, POST, PUT, DELETE, HEAD, CONNECT, OPTIONS or TRACE (any case), and NONE for any other value. When set, the verb option and the CamelDaprVerb, CamelDaprQueryParameters and CamelDaprHttpHeaders headers are not used. The option is a io.dapr.client.domain.HttpExtension type.

HttpExtension

camel.component.dapr.key

The key of the value in the state store for the state save, get and delete operations, or the name of the secret to get with the secret operation. When the secret operation has no key, it gets all the secrets of the secret store.

String

camel.component.dapr.lazy-start-producer

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

camel.component.dapr.lock-operation

The operation on the distributed lock: tryLock acquires the lock (the message body is then true when acquired, false otherwise), unlock releases it.

trylock

LockOperation

camel.component.dapr.lock-owner

The ID of the owner of the lock: only the owner that acquired the lock can unlock it. Required for the lock operation.

String

camel.component.dapr.metadata

Additional key-value pairs to pass as metadata to the Dapr building block, such as metadata.namespace=production. Used by the state get, getBulk, delete and executeTransaction operations, pubSub, invokeBinding, secret and configuration; the state save and saveBulk, invokeService, lock and workflow operations and the consumers do not pass it. The CamelDaprMetadata header takes the place of these for one message, except for the secret operation unless allowSecretStoreAndKeyFromHeaders is enabled. This is a multi-value option with prefix: metadata.

String>

camel.component.dapr.method-to-invoke

The method to call on the service with the invokeService operation: the path that follows /method/ in the Dapr invocation URL, such as orders or api/orders.

String

camel.component.dapr.preview-client

The DaprPreviewClient for the lock operation and the pubSub consumer (streaming subscription to a topic). When not set, one is built with DaprClientBuilder from the Dapr properties. The option is a io.dapr.client.DaprPreviewClient type.

DaprPreviewClient

camel.component.dapr.pub-sub-name

The name of the Dapr pub/sub component to publish to (producer) or to subscribe to (consumer) with the pubSub operation. Required for the pubSub operation.

String

camel.component.dapr.reason

The reason for suspending or resuming the workflow instance. Required for the suspend and resume workflow operations.

String

camel.component.dapr.resource-id

The ID of the resource to lock or unlock with the lock operation. Required for the lock operation.

String

camel.component.dapr.secret-store

The name of the Dapr secret store component of the secret operation. Required for the secret operation.

String

camel.component.dapr.service-to-invoke

The service to call with the invokeService operation: the app ID of a Dapr application, the name of an HTTPEndpoint resource, or the URL of a non-Dapr endpoint.

String

camel.component.dapr.state-operation

The operation on the state store: save (one key), saveBulk (the states of the CamelDaprStates header), get (one key), getBulk (the keys of the CamelDaprKeys header), delete (one key) or executeTransaction (the operations of the CamelDaprTransactions header in one transaction).

get

StateOperation

camel.component.dapr.state-store

The name of the Dapr state store component of the state operation. Required for the state operation.

String

camel.component.dapr.store-name

The name of the Dapr lock store component of the lock operation. Required for the lock operation.

String

camel.component.dapr.timeout

How long the waitForInstanceStart and waitForInstanceCompletion workflow operations wait for the workflow instance to start or to complete, before they fail. Required for these operations.

Duration

camel.component.dapr.topic

The topic to publish to (producer) or to subscribe to (consumer) in the pub/sub component given by pubSubName. Required for the pubSub operation.

String

camel.component.dapr.verb

The HTTP method of the invokeService operation, in upper case: GET, POST, PUT, DELETE, PATCH, HEAD, CONNECT, OPTIONS or TRACE. Not used when an HttpExtension is set with the httpExtension option or the CamelDaprHttpExtension header.

POST

String

camel.component.dapr.workflow-class

The fully qualified name of the workflow class to start with the scheduleNew workflow operation: a class that implements io.dapr.workflows.Workflow and is registered in the workflow runtime. Required for scheduleNew.

String

camel.component.dapr.workflow-client

The DaprWorkflowClient for the workflow operation. When not set, the endpoint creates one from the Dapr properties. The option is a io.dapr.workflows.client.DaprWorkflowClient type.

DaprWorkflowClient

camel.component.dapr.workflow-instance-id

The ID of the workflow instance. For scheduleNew it is the ID of the new instance, and the Dapr client generates a random UUID when it is not set; the other workflow operations require it.

String

camel.component.dapr.workflow-operation

The operation of the workflow client: scheduleNew (start a new workflow instance), terminate, purge (delete the state of a completed or terminated instance), suspend, resume, state (get the state of an instance), waitForInstanceStart, waitForInstanceCompletion or raiseEvent (send an event to an instance).

schedulenew

WorkflowOperation

camel.component.dapr.workflow-start-time

The time at which the scheduleNew workflow operation starts the new workflow instance. When not set, the instance starts right away.

Instant

camel.component.dapr.workflow-version

The version of the workflow to start with the scheduleNew workflow operation.

String