Dapr
Since Camel 4.12
Both producer and consumer are supported
The Dapr Component provides support for interacting with the Dapr Building Blocks.
URI format
dapr:operation[?options]
Where operation indicates the specific Dapr building block to interact with.
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 Dapr component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Autowired 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. | DaprClient | ||
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 | ||
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 | ||
The configuration shared by the endpoints of this component. | DaprConfiguration | ||
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 | ||
Autowired 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. | DaprPreviewClient | ||
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 | ||
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 | ||
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 | |
The name of the Dapr output binding component to call with the invokeBinding operation. | String | ||
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 | ||
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. Enum values:
| Concurrency | ||
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. Enum values:
| Consistency | ||
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 | ||
The name of the event to send to the workflow instance with the raiseEvent workflow operation. Event names are case-insensitive. | String | ||
The time in seconds after which the lock expires, if not unlocked before. Required for the tryLock lock operation. | Integer | ||
Whether the state, waitForInstanceStart and waitForInstanceCompletion workflow operations also fetch the inputs, outputs and custom status of the workflow instance. | false | boolean | |
Autowired 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. | HttpExtension | ||
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 | ||
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 on the distributed lock: tryLock acquires the lock (the message body is then true when acquired, false otherwise), unlock releases it. Enum values:
| tryLock | LockOperation | |
The ID of the owner of the lock: only the owner that acquired the lock can unlock it. Required for the lock operation. | String | ||
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. | Map | ||
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 | ||
The reason for suspending or resuming the workflow instance. Required for the suspend and resume workflow operations. | String | ||
The ID of the resource to lock or unlock with the lock operation. Required for the lock operation. | String | ||
The name of the Dapr secret store component of the secret operation. Required for the secret operation. | String | ||
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 | ||
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). Enum values:
| get | StateOperation | |
The name of the Dapr state store component of the state operation. Required for the state operation. | String | ||
The name of the Dapr lock store component of the lock operation. Required for the lock operation. | String | ||
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 | ||
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 | |
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 | ||
Autowired The DaprWorkflowClient for the workflow operation. When not set, the endpoint creates one from the Dapr properties. | DaprWorkflowClient | ||
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 | ||
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). Enum values:
| scheduleNew | WorkflowOperation | |
The time at which the scheduleNew workflow operation starts the new workflow instance. When not set, the instance starts right away. | Instant | ||
The version of the workflow to start with the scheduleNew workflow operation. | String | ||
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 | |
To use a custom HeaderFilterStrategy to filter header to and from Camel message. | HeaderFilterStrategy | ||
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 |
Endpoint Options
The Dapr endpoint is configured using URI syntax:
dapr:operation
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The Dapr building block to use: invokeService (service invocation), state (state management), pubSub (publish and subscribe), invokeBinding (output bindings), secret (secrets), configuration, lock (distributed lock) or workflow. The consumer supports only pubSub (subscribe to a topic) and configuration (subscribe to configuration changes). Enum values:
| DaprOperation |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Autowired 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. | DaprClient | ||
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 | ||
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 | ||
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 | ||
Autowired 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. | DaprPreviewClient | ||
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 | ||
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 | ||
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 | ||
The name of the Dapr output binding component to call with the invokeBinding operation. | String | ||
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 | ||
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. Enum values:
| Concurrency | ||
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. Enum values:
| Consistency | ||
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 | ||
The name of the event to send to the workflow instance with the raiseEvent workflow operation. Event names are case-insensitive. | String | ||
The time in seconds after which the lock expires, if not unlocked before. Required for the tryLock lock operation. | Integer | ||
Whether the state, waitForInstanceStart and waitForInstanceCompletion workflow operations also fetch the inputs, outputs and custom status of the workflow instance. | false | boolean | |
Autowired 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. | HttpExtension | ||
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 | ||
The operation on the distributed lock: tryLock acquires the lock (the message body is then true when acquired, false otherwise), unlock releases it. Enum values:
| tryLock | LockOperation | |
The ID of the owner of the lock: only the owner that acquired the lock can unlock it. Required for the lock operation. | String | ||
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. | Map | ||
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 | ||
The reason for suspending or resuming the workflow instance. Required for the suspend and resume workflow operations. | String | ||
The ID of the resource to lock or unlock with the lock operation. Required for the lock operation. | String | ||
The name of the Dapr secret store component of the secret operation. Required for the secret operation. | String | ||
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 | ||
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). Enum values:
| get | StateOperation | |
The name of the Dapr state store component of the state operation. Required for the state operation. | String | ||
The name of the Dapr lock store component of the lock operation. Required for the lock operation. | String | ||
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 | ||
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 | |
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 | ||
Autowired The DaprWorkflowClient for the workflow operation. When not set, the endpoint creates one from the Dapr properties. | DaprWorkflowClient | ||
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 | ||
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). Enum values:
| scheduleNew | WorkflowOperation | |
The time at which the scheduleNew workflow operation starts the new workflow instance. When not set, the instance starts right away. | Instant | ||
The version of the workflow to start with the scheduleNew workflow operation. | String | ||
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 | |
To use a custom HeaderFilterStrategy to filter header to and from Camel message. | HeaderFilterStrategy | ||
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 |
Message Headers
The Dapr component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelDaprServiceToInvoke (producer) Constant: | 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 | |
CamelDaprMethodToInvoke (producer) Constant: | The method to call on the service with the invokeService operation: the path that follows /method/ in the Dapr invocation URL. | String | |
| Constant: | The HTTP method of the invokeService operation, in upper case, such as GET or POST. Not used when an HttpExtension is set. | String | |
CamelDaprQueryParameters (producer) Constant: | The query parameters of the invokeService request. Not used when an HttpExtension is set. | Map | |
CamelDaprHttpHeaders (producer) Constant: | The HTTP headers of the invokeService request. Not used when an HttpExtension is set. | Map | |
CamelDaprHttpExtension (producer) Constant: | The HttpExtension (HTTP method, query parameters and HTTP headers) of the invokeService operation. Takes precedence over the httpExtension and verb options and the CamelDaprVerb, CamelDaprQueryParameters and CamelDaprHttpHeaders headers. | HttpExtension | |
CamelDaprStateOperation (producer) Constant: | The operation on the state store, in place of the stateOperation option. Enum values:
| get | StateOperation |
CamelDaprStateStore (producer) Constant: | The name of the Dapr state store component of the state operation. | String | |
CamelDaprSecretStore (producer) Constant: | The name of the Dapr secret store component of the secret operation. This header is ignored unless the endpoint enables allowSecretStoreAndKeyFromHeaders=true (disabled by default). | String | |
CamelDaprConfigStore (producer) Constant: | The name of the Dapr configuration store component of the configuration operation. | String | |
| Constant: | 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. For the secret operation, this header is ignored unless the endpoint enables allowSecretStoreAndKeyFromHeaders=true (disabled by default). | String | |
| Constant: | The ETag of the value in the state store, for optimistic concurrency of the state save and delete operations. | String | |
CamelDaprConcurrency (producer) Constant: | The concurrency mode of the state save, get and delete operations: FIRST_WRITE or LAST_WRITE. Enum values:
| Concurrency | |
CamelDaprConsistency (producer) Constant: | The consistency level of the state save, get and delete operations: EVENTUAL or STRONG. Enum values:
| Consistency | |
| Constant: | Additional key-value pairs to be passed to the Dapr building block, in place of the metadata option. For the secret operation, this header is ignored unless the endpoint enables allowSecretStoreAndKeyFromHeaders=true (disabled by default). | Map | |
| Constant: | The states (key, value and optional ETag and options of each) to save with the state saveBulk operation. Required for saveBulk. | List | |
| Constant: | The keys of the values to get with the state getBulk operation. Required for getBulk. | List | |
CamelDaprTransactions (producer) Constant: | The operations (upsert or delete) to run in one transaction with the state executeTransaction operation. Required for executeTransaction. | List | |
| Constant: | The name of the Dapr pub/sub component to publish to with the pubSub operation. | String | |
| Constant: | The topic to publish to with the pubSub operation. | String | |
| Constant: | The content type of the event data that the pubSub operation publishes. | String | |
| Constant: | The ID of the received CloudEvent. | String | |
| Constant: | The source of the received CloudEvent: a URI that identifies the application that published the event. | String | |
| Constant: | The type of the received CloudEvent. | String | |
CamelDaprSpecificVersion (consumer) Constant: | The version of the CloudEvents specification of the received event (specversion). | String | |
CamelDaprDataContentType (consumer) Constant: | The content type of the data of the received CloudEvent (datacontenttype). | String | |
CamelDaprBinaryData (consumer) Constant: | The binary data of the received CloudEvent (data_base64), if any. | byte[] | |
| Constant: | The time at which the received CloudEvent occurred. | OffsetDateTime | |
CamelDaprTraceParent (consumer) Constant: | The W3C traceparent of the received CloudEvent, with the trace ID and the span ID. | String | |
CamelDaprTraceState (consumer) Constant: | The W3C tracestate of the received CloudEvent, with vendor-specific trace context. | String | |
CamelDaprBindingName (producer) Constant: | The name of the Dapr output binding component to call with the invokeBinding operation. | String | |
CamelDaprBindingOperation (producer) Constant: | The operation of the output binding to call with the invokeBinding operation, such as create, get, delete or list. | String | |
CamelDaprConfigKeys (producer) Constant: | The keys of the configuration items to get with the configuration operation, as a comma-separated String or a Collection of keys. | String | |
CamelDaprSubscriptionId (consumer) Constant: | The ID of the subscription to configuration changes that received the change. | String | |
CamelDaprRawConfigResponse (common) Constant: | The ConfigurationItem (value, version and metadata) of each key, as received from Dapr: the items read by the configuration producer, or the items changed for the configuration consumer. | ConfigurationItem | |
CamelDaprLockOperation (producer) Constant: | The operation on the distributed lock, in place of the lockOperation option. Enum values:
| tryLock | LockOperation |
| Constant: | The name of the Dapr lock store component of the lock operation. | String | |
CamelDaprResourceId (producer) Constant: | The ID of the resource to lock or unlock with the lock operation. | String | |
| Constant: | The ID of the owner of the lock: only the owner that acquired the lock can unlock it. | String | |
CamelDaprExpiryInSeconds (producer) Constant: | The time in seconds after which the lock expires, if not unlocked before. Required for tryLock. | Integer | |
CamelDaprWorkflowOperation (producer) Constant: | The operation of the workflow client, in place of the workflowOperation option. Enum values:
| scheduleNew | WorkflowOperation |
CamelDaprWorkflowClass (producer) Constant: | The fully qualified name of the workflow class to start with the scheduleNew workflow operation: a class that implements io.dapr.workflows.Workflow. | String | |
CamelDaprWorkflowVersion (producer) Constant: | The version of the workflow to start with the scheduleNew workflow operation. | String | |
CamelDaprWorkflowInstanceId (producer) Constant: | The ID of the workflow instance of the workflow operation. The terminate, purge, suspend, resume and raiseEvent operations also set it on the result. | String | |
CamelDaprWorkflowStartTime (producer) Constant: | The time at which the scheduleNew workflow operation starts the new workflow instance. | Instant | |
CamelDaprSuspendReason (producer) Constant: | The reason for suspending or resuming the workflow instance. The suspend and resume operations also set it on the result. | String | |
CamelDaprNewWorkflowInstanceId (producer) Constant: | The ID of the workflow instance that the scheduleNew workflow operation started. | String | |
CamelDaprGetWorkflowIO (producer) Constant: | Whether the state, waitForInstanceStart and waitForInstanceCompletion workflow operations also fetch the inputs, outputs and custom status of the workflow instance. | boolean | |
CamelDaprWorkflowName (producer) Constant: | The name of the workflow, set by the state, waitForInstanceStart and waitForInstanceCompletion workflow operations. | String | |
CamelDaprWorkflowCreatedAt (producer) Constant: | The time in UTC at which the workflow instance was created, set by the state and wait workflow operations. | Instant | |
CamelDaprWorkflowUpdatedAt (producer) Constant: | The time in UTC at which the workflow instance was last updated, set by the state and wait workflow operations. | Instant | |
CamelDaprWorkflowSerializedInput (producer) Constant: | The serialized input of the workflow instance, if any, set by the state and wait workflow operations when the inputs and outputs are fetched. | String | |
CamelDaprWorkflowSerializedOutput (producer) Constant: | The serialized output of the workflow instance, if any, set by the state and wait workflow operations when the inputs and outputs are fetched. | String | |
CamelDaprWorkflowFailureDetails (producer) Constant: | The failure details of the workflow instance when it failed, otherwise null, set by the state and wait workflow operations. | WorkflowFailureDetails | |
CamelDaprIsWorkflowRunning (producer) Constant: | Whether the workflow instance exists and is running, set by the state and wait workflow operations. | boolean | |
CamelDaprIsWorkflowCompleted (producer) Constant: | Whether the workflow instance is in a terminal state (completed, failed or terminated), set by the state and wait workflow operations. | boolean | |
| Constant: | How long the waitForInstanceStart and waitForInstanceCompletion workflow operations wait for the workflow instance to start or to complete, before they fail. | Duration | |
| Constant: | The name of the event to send to the workflow instance with the raiseEvent workflow operation. Event names are case-insensitive. The raiseEvent operation also sets it on the result. | String |
Message Body
The message body at each side of the Dapr 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 |
| For pubSub the data of the cloud event as bytes, with its id, type, source and content type in headers. For configuration a Map of the changed keys and their values, with the ConfigurationItems in the CamelDaprRawConfigResponse header.
|
Producer input |
| The data of invokeService, pubSub, invokeBinding, state save and the workflow input, event and output. For invokeService, pubSub, invokeBinding and state save, text and streams are converted to bytes, bytes are sent as they are, and other bodies are serialized as JSON. The workflow operations give the body to the workflow client as is, which serializes it as JSON, so a stream fails there: convert it first. State save needs a body; the other operations do not read it. |
Producer output |
| The response as bytes for invokeService and invokeBinding (null when there is none), the PublishEventRequest for pubSub, the State for state get and save, a List of State for getBulk and the request for the other state operations, a Map for secret and configuration, true or false for tryLock and the UnlockResponseStatus for unlock. For workflow the NewWorkflowOptions for scheduleNew, the WorkflowState for state and the waits, unchanged for terminate and raiseEvent, and null otherwise.
|
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.
Dapr Producer operations
Camel Dapr component provides a wide range of operations on the producer side:
The producer keeps the headers of the message, and adds the headers of the Dapr response, such as CamelDaprRawConfigResponse for the configuration operation.
The invokeService, pubSub, invokeBinding and state save operations send the message body as the data: a text or stream body is converted to bytes and sent as it is, bytes are sent as they are, and other bodies, such as a Map or a POJO, are serialized as JSON. For pubSub, set the content type of the data with the contentType option or the CamelDaprContentType header.
1. invokeService:
Using service invocation, your application can reliably and securely communicate with other applications using the standard HTTP protocol. For this operation serviceToInvoke and methodToInvoke are mandatory.
2. state:
State management in Dapr allows your application to save, get and delete key-value pairs in a reliable and consistent way. For these operations stateStore is required.
State Operations
| Operation | Description |
|---|---|
| Store or update a single key-value pair in the state store. For this operation |
| Store or update multiple key-value pairs in the state store in a single operation. For this operation (List<State<?>>) |
| Retrieve the value of a specific key from the state store. For this operation |
| Retrieve values for multiple keys from the state store in a single request. For this operation (List<String>) |
| Remove a specific key and its associated value from the state store. For this operation |
| Execute a batch of operations (save or delete) atomically within a transaction. For this operation (List<TransactionalStateOperation<?>>) |
2. pubSub:
Dapr’s publish-subscribe (Pub/Sub) building block enables asynchronous, event-driven communication between microservices. For this operation, the pubSubName and topic are required.
3. invokeBinding:
Dapr’s bindings building block allows interaction with external systems via input/output bindings. The invokeBinding operation enables sending data to a configured output binding. This operation requires specifying the bindingName (the name of the binding component) and the bindingOperation (such as create, get, or delete, depending on the binding’s capabilities).
4. secret:
Dapr’s secret management building block enables secure retrieval of secrets from external secret stores. The secret operation fetches a secret from the specified secret store. If a key is provided, the operation retrieves the corresponding secret; if no key is specified, a bulk retrieval of all secrets from the store is performed. This operation requires the secretStore name, and optionally the key.
The secret operation takes the secret store, the key and the metadata from the secretStore, key and metadata options of the endpoint, unless the endpoint sets allowSecretStoreAndKeyFromHeaders=true: only then do the CamelDaprSecretStore, CamelDaprKey and CamelDaprMetadata headers take their place. An endpoint without a key fails, instead of reading all the secrets of the store, when the message has a CamelDaprKey header that it ignores.
5. configuration:
Dapr’s configuration building block allows applications to retrieve dynamic configuration values from external configuration stores. The configuration operation fetches values associated with keys specified in configKeys. This operation requires the configStore name, and the configKeys.
6. lock:
Lock management in Dapr allows your application to coordinate access to shared resources using a distributed lock mechanism. This is useful for ensuring mutual exclusion across services. For these operations, storeName, resourceId and lockOwner are mandatory.
Lock Operations
| Operation | Description |
|---|---|
| Attempts to acquire a lock on a resource for a specific duration. For this operation |
| Releases a previously acquired lock. Returns an |
7. workflow:
Dapr Workflows enable developers to write long-running, persistent, and reliable processes as code. Dapr Workflow simplifies complex, stateful coordination requirements in microservice architectures.
Workflow Operations
| Operation | Description |
|---|---|
| Schedules a new workflow instance to be created. Requires |
| Terminates a running workflow instance. Requires |
| Purges the metadata of a workflow instance from the state store. Requires |
| Suspends a running workflow instance. Requires |
| Resumes a suspended workflow instance. Requires |
| Gets the current runtime state of a workflow instance. Requires |
| Waits for a workflow instance to start running. Requires |
| Waits for a workflow instance to complete. Requires |
| Sends an event to a running workflow instance that is waiting for it. Requires |
Headers that override the endpoint
The producer headers, such as CamelDaprServiceToInvoke, CamelDaprStateStore, CamelDaprKey, CamelDaprMetadata, CamelDaprPubSubName, CamelDaprTopic, CamelDaprBindingName, CamelDaprStoreName or CamelDaprWorkflowInstanceId, take the place of the endpoint option of the same name for one message.
The metadata that an operation sends to the Dapr building block is set on the endpoint with metadata. options, such as metadata.ttlInSeconds=60 for pubSub, or for one message with the CamelDaprMetadata header (a Map<String, String>).
For the secret operation, the CamelDaprSecretStore, CamelDaprKey and CamelDaprMetadata headers are ignored unless the endpoint sets allowSecretStoreAndKeyFromHeaders=true. With that option, they take the place of the secret store, the key and the metadata of the endpoint for one message, so the message chooses the secret that the operation reads.
As the producer keeps the headers of the message, a CamelDapr* header also applies to the next dapr call of the route. When the messages come from an untrusted producer through a consumer that does not filter out Camel* headers, or when a dapr call must use only the options of its endpoint, remove these headers with removeHeaders("CamelDapr*") before the dapr endpoint.
1. pubSub:
The Dapr PubSub Consumer in Apache Camel allows your route to consume events from a Dapr-supported Pub/Sub system. It subscribes to a specified topic on a given pubsub component (pubSubName) and processes incoming CloudEvents as Camel Exchange objects.
To configure a consumer, the pubSubName and topic must be provided. Alternatively, a preconfigured DaprPreviewClient can be registered in the Camel registry to allow the consumer to reuse it instead of creating a new one internally.
When the stream of the subscription to the Dapr sidecar fails, for example because the sidecar restarts, the consumer subscribes again, first after one second and then with a delay that doubles up to 30 seconds while the sidecar cannot be reached. The delay starts again at one second once an event is received.
2. configuration:
The Dapr Configuration Consumer in Apache Camel allows your route to receive real-time updates from a Dapr-supported configuration store. It listens for changes to specified keys in the configuration store and processes the updates as Camel Exchange objects.
To configure the consumer, the configStore name and configKeys must be provided.
When the subscription ends, for example because the Dapr sidecar restarts, the consumer subscribes again, first after one second and then with a growing delay of up to 30 seconds while the sidecar cannot be reached. A change made to the configuration store while the consumer is not subscribed is not delivered.
Examples
Producer Operations Examples
-
invokeService-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprVerb", constant("GET"))
.to("dapr:invokeService?serviceToInvoke=myService&methodToInvoke=myMethod")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprVerb">
<constant>GET</constant>
</setHeader>
<to uri="dapr:invokeService?serviceToInvoke=myService&methodToInvoke=myMethod"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprVerb
constant: "GET"
- to:
uri: dapr:invokeService
parameters:
serviceToInvoke: myService
methodToInvoke: myMethod
- to:
uri: mock:result -
state: save-
-
Java
-
XML
-
YAML
from("direct:start")
.setBody(constant("myValue"))
.to("dapr:state?stateOperation=save&stateStore=myStore&key=myKey")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setBody>
<constant>myValue</constant>
</setBody>
<to uri="dapr:state?stateOperation=save&stateStore=myStore&key=myKey"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setBody:
constant: "myValue"
- to:
uri: dapr:state
parameters:
stateOperation: save
stateStore: myStore
key: myKey
- to:
uri: mock:result -
state: saveBulk-
State types and List.of() to set bulk statesfrom("direct:start")
.process(exchange -> {
State<String> state1 = new State<>("key1", "val1", "etag1");
State<String> state2 = new State<>("key2", "val1", "etag2");
List<State<?>> states = List.of(state1, state2);
exchange.getMessage().setHeader("CamelDaprStates", states);
})
.to("dapr:state?stateOperation=saveBulk&stateStore=myStore")
.to("mock:result"); -
state: get-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprConcurrency", constant("FIRST_WRITE"))
.setHeader("CamelDaprConsistency", constant("EVENTUAL"))
.to("dapr:state?stateOperation=get&stateStore=myStore&key=myKey")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprConcurrency">
<constant>FIRST_WRITE</constant>
</setHeader>
<setHeader name="CamelDaprConsistency">
<constant>EVENTUAL</constant>
</setHeader>
<to uri="dapr:state?stateOperation=get&stateStore=myStore&key=myKey"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprConcurrency
constant: "FIRST_WRITE"
- setHeader:
name: CamelDaprConsistency
constant: "EVENTUAL"
- to:
uri: dapr:state
parameters:
stateOperation: get
stateStore: myStore
key: myKey
- to:
uri: mock:result -
state: getBulk-
List.of() to set bulk key listfrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader("CamelDaprKeys", List.of("key1", "key2"));
})
.to("dapr:state?stateOperation=getBulk&stateStore=myStore")
.to("mock:result"); -
state: delete-
Map.of() to set metadatafrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader("CamelDaprMetadata", Map.of("partitionKey", "myPartitionKey"));
})
.to("dapr:state?stateOperation=delete&stateStore=myStore&key=myKey")
.to("mock:result"); -
state: executeTransaction-
TransactionalStateOperation and State typesfrom("direct:start")
.process(exchange -> {
TransactionalStateOperation.OperationType op = TransactionalStateOperation.OperationType.UPSERT;
List<TransactionalStateOperation<?>> transactions = List.of(new TransactionalStateOperation<>(op, new State<>("myKey")));
exchange.getIn().setHeader("CamelDaprTransactions", transactions);
})
.to("dapr:state?stateOperation=executeTransaction&stateStore=myStore")
.to("mock:result"); -
pubSub-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprContentType", constant("application/json"))
.to("dapr:pubSub?pubSubName=myPubSub&topic=myTopic")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprContentType">
<constant>application/json</constant>
</setHeader>
<to uri="dapr:pubSub?pubSubName=myPubSub&topic=myTopic"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprContentType
constant: "application/json"
- to:
uri: dapr:pubSub
parameters:
pubSubName: myPubSub
topic: myTopic
- to:
uri: mock:result -
invokeBinding-
-
Java
-
XML
-
YAML
from("direct:start")
.setBody(constant("myBody"))
.to("dapr:invokeBinding?bindingName=myBinding&bindingOperation=myOperation")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setBody>
<constant>myBody</constant>
</setBody>
<to uri="dapr:invokeBinding?bindingName=myBinding&bindingOperation=myOperation"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setBody:
constant: "myBody"
- to:
uri: dapr:invokeBinding
parameters:
bindingName: myBinding
bindingOperation: myOperation
- to:
uri: mock:result -
secret-
-
Java
-
XML
-
YAML
from("direct:start")
.to("dapr:secret?secretStore=myStore&key=mySecret")
.log("Received secret mySecret from Dapr")
.to("mock:result"); <route>
<from uri="direct:start"/>
<to uri="dapr:secret?secretStore=myStore&key=mySecret"/>
<log message="Received secret mySecret from Dapr"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: dapr:secret
parameters:
secretStore: myStore
key: mySecret
- log: "Received secret mySecret from Dapr"
- to:
uri: mock:result -
secret: bulk-
-
Java
-
XML
-
YAML
from("direct:start")
// when no secret key is passed, bulk retrieval is performed on secret store
.to("dapr:secret?secretStore=myStore")
.log("Received ${body.size()} secrets from Dapr")
.to("mock:result"); <route>
<from uri="direct:start"/>
<to uri="dapr:secret?secretStore=myStore"/>
<log message="Received ${body.size()} secrets from Dapr"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: dapr:secret
parameters:
secretStore: myStore
- log: "Received ${body.size()} secrets from Dapr"
- to:
uri: mock:result -
configuration-
The CamelDaprConfigKeys header takes the place of the configKeys option. It is a comma-separated String or a Collection of keys.
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprConfigKeys", constant("k1,k2"))
.to("dapr:configuration?configStore=myStore")
.log("Received config updates from Dapr: ${body}")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprConfigKeys">
<constant>k1,k2</constant>
</setHeader>
<to uri="dapr:configuration?configStore=myStore"/>
<log message="Received config updates from Dapr: ${body}"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprConfigKeys
constant: "k1,k2"
- to:
uri: dapr:configuration
parameters:
configStore: myStore
- log: "Received config updates from Dapr: ${body}"
- to:
uri: mock:result -
lock: tryLock-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprResourceId", constant("myResource"))
.to("dapr:lock?lockOperation=tryLock&storeName=myStore&expiryInSeconds=100")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprResourceId">
<constant>myResource</constant>
</setHeader>
<to uri="dapr:lock?lockOperation=tryLock&storeName=myStore&expiryInSeconds=100"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprResourceId
constant: "myResource"
- to:
uri: dapr:lock
parameters:
lockOperation: tryLock
storeName: myStore
expiryInSeconds: 100
- to:
uri: mock:result -
lock: unlock-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprResourceId", constant("myResource"))
.to("dapr:lock?lockOperation=unlock&storeName=myStore")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprResourceId">
<constant>myResource</constant>
</setHeader>
<to uri="dapr:lock?lockOperation=unlock&storeName=myStore"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprResourceId
constant: "myResource"
- to:
uri: dapr:lock
parameters:
lockOperation: unlock
storeName: myStore
- to:
uri: mock:result -
workflow: scheduleNew-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowClass", constant("my.package.MyWorkflow"))
.to("dapr:workflow?workflowOperation=scheduleNew")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowClass">
<constant>my.package.MyWorkflow</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=scheduleNew"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowClass
constant: "my.package.MyWorkflow"
- to:
uri: dapr:workflow
parameters:
workflowOperation: scheduleNew
- to:
uri: mock:result -
workflow: terminate-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowInstanceId", constant("myWorkflowInstanceId"))
.to("dapr:workflow?workflowOperation=terminate")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowInstanceId">
<constant>myWorkflowInstanceId</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=terminate"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowInstanceId
constant: "myWorkflowInstanceId"
- to:
uri: dapr:workflow
parameters:
workflowOperation: terminate
- to:
uri: mock:result -
workflow: purge-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowInstanceId", constant("myWorkflowInstanceId"))
.to("dapr:workflow?workflowOperation=purge")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowInstanceId">
<constant>myWorkflowInstanceId</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=purge"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowInstanceId
constant: "myWorkflowInstanceId"
- to:
uri: dapr:workflow
parameters:
workflowOperation: purge
- to:
uri: mock:result -
workflow: suspend-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowInstanceId", constant("myWorkflowInstanceId"))
.setHeader("CamelDaprSuspendReason", constant("Suspended for maintenance."))
.to("dapr:workflow?workflowOperation=suspend")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowInstanceId">
<constant>myWorkflowInstanceId</constant>
</setHeader>
<setHeader name="CamelDaprSuspendReason">
<constant>Suspended for maintenance.</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=suspend"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowInstanceId
constant: "myWorkflowInstanceId"
- setHeader:
name: CamelDaprSuspendReason
constant: "Suspended for maintenance."
- to:
uri: dapr:workflow
parameters:
workflowOperation: suspend
- to:
uri: mock:result -
workflow: resume-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowInstanceId", constant("myWorkflowInstanceId"))
.setHeader("CamelDaprSuspendReason", constant("Maintenance complete."))
.to("dapr:workflow?workflowOperation=resume")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowInstanceId">
<constant>myWorkflowInstanceId</constant>
</setHeader>
<setHeader name="CamelDaprSuspendReason">
<constant>Maintenance complete.</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=resume"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowInstanceId
constant: "myWorkflowInstanceId"
- setHeader:
name: CamelDaprSuspendReason
constant: "Maintenance complete."
- to:
uri: dapr:workflow
parameters:
workflowOperation: resume
- to:
uri: mock:result -
workflow: state-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowInstanceId", constant("myWorkflowInstanceId"))
.to("dapr:workflow?workflowOperation=state")
.log("Workflow state: ${body}")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowInstanceId">
<constant>myWorkflowInstanceId</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=state"/>
<log message="Workflow state: ${body}"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowInstanceId
constant: "myWorkflowInstanceId"
- to:
uri: dapr:workflow
parameters:
workflowOperation: state
- log:
message: "Workflow state: ${body}"
- to:
uri: mock:result -
workflow: waitForInstanceStart-
Duration.ofSeconds() to set timeoutfrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader("CamelDaprWorkflowInstanceId", "myWorkflowInstanceId");
exchange.getIn().setHeader("CamelDaprTimeout", Duration.ofSeconds(30));
})
.to("dapr:workflow?workflowOperation=waitForInstanceStart")
.to("mock:result"); -
workflow: waitForInstanceCompletion-
Duration.ofSeconds() to set timeoutfrom("direct:start")
.process(exchange -> {
exchange.getIn().setHeader("CamelDaprWorkflowInstanceId", "myWorkflowInstanceId");
exchange.getIn().setHeader("CamelDaprTimeout", Duration.ofSeconds(30));
})
.to("dapr:workflow?workflowOperation=waitForInstanceCompletion")
.to("mock:result"); -
workflow: raiseEvent-
-
Java
-
XML
-
YAML
from("direct:start")
.setHeader("CamelDaprWorkflowInstanceId", constant("myWorkflowInstanceId"))
.to("dapr:workflow?workflowOperation=raiseEvent&eventName=MyEvent")
.to("mock:result"); <route>
<from uri="direct:start"/>
<setHeader name="CamelDaprWorkflowInstanceId">
<constant>myWorkflowInstanceId</constant>
</setHeader>
<to uri="dapr:workflow?workflowOperation=raiseEvent&eventName=MyEvent"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: direct:start
steps:
- setHeader:
name: CamelDaprWorkflowInstanceId
constant: "myWorkflowInstanceId"
- to:
uri: dapr:workflow
parameters:
workflowOperation: raiseEvent
eventName: MyEvent
- to:
uri: mock:result Consumer Operations Examples
-
pubSub-
-
Java
-
XML
-
YAML
from("dapr:pubSub?pubSubName=myPubSub&topic=myTopic")
.log("Received message from Dapr pubsub: ${body}")
.to("mock:result"); <route>
<from uri="dapr:pubSub?pubSubName=myPubSub&topic=myTopic"/>
<log message="Received message from Dapr pubsub: ${body}"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: dapr:pubSub
parameters:
pubSubName: myPubSub
topic: myTopic
steps:
- log: "Received message from Dapr pubsub: ${body}"
- to:
uri: mock:result -
configuration-
-
Java
-
XML
-
YAML
from("dapr:configuration?configStore=myStore&configKeys=k1,k2")
.log("Received config updates from Dapr: ${body}")
.to("mock:result"); <route>
<from uri="dapr:configuration?configStore=myStore&configKeys=k1,k2"/>
<log message="Received config updates from Dapr: ${body}"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: dapr:configuration
parameters:
configStore: myStore
configKeys: "k1,k2"
steps:
- log: "Received config updates from Dapr: ${body}"
- to:
uri: mock:result