Broadleaf Microservices
  • v1.0.0-latest-prod

Messaging Configuration

Overview

There are various properties you can configure when utilizing Broadleaf’s messaging features in any service.

Cluster Properties

Properties related to general cluster singleton config. These properties tend to be set for each individual FlexPackage™ deployment.

Property Description

broadleaf.messaging.clusterServiceImplementationType

Specify which camel cluster service implementation to support. Supported values are: file, zookeeper, kubernetes, and none. none is useful to disable out-of-the-box config, presumably so you can manually add different or new cluster service implementation support. Default is file. file is suitable for local development, but in a real-world production environment, zookeeper or kubernetes should be used instead in order to support proper cluster service establishment across multiple instances of a given service.

broadleaf.messaging.clusterK8sAppLabel

If using kubernetes cluster service implementation type, this is the name of the pod label used to group common service instances. The default value is k8s-app.

broadleaf.messaging.clusterK8sAppLabelValue

If using kubernetes cluster service implementation type, this is the value for the pod label. The default is unknown and this value must be set (generally as a environment variable on a pod definition) in order to inform the camel support running in that pod.

Persistence Producer Properties

Configuration properties for the NotificationHandler and RetryHandler related to PersistenceProducer

Property Description

broadleaf.persistence.notification.*

See com.broadleafcommerce.common.messaging.notification.NotificationProperties for full list of options.

broadleaf.persistence.retry.*

See com.broadleafcommerce.common.messaging.notification.RetryProperties for full list of options.

Async Persistence Producer Properties

Property Description Default

broadleaf.notification.manager.thread-pool-size

The thread pool size used for async handling. The producer will not block during the attempt to send when calling the handleAsync method.

10

broadleaf.notification.manager.async-enabled

Whether calls to handleAsync method will actually use the thread pool, or if they will instead block like the normal handle call. This can be useful in tests, or if reverting to the previous behavior is desired.

true

Resource Lock Properties

Properties related to the repository responsible for allowing requesters to lock and unlock a resource.

Property Description

broadleaf.resource.lock.defaultStagnationThreshold

The time, once elapsed, in which the system will consider a lock abandoned and allow another requester to acquire the lock. The default value is 15 (seconds).

broadleaf.resource.lock.lockPurgePageSize

The number of lock records to purge in a single page. Default value is 1000.

Non-Blocking Retry Properties

Properties related non-blocking retry configuration

Property Description Default

broadleaf.messaging.nonblocking.retry.cloud.stream.enabled

Whether the non-blocking retry feature is enabled. The feature must be enabled for any non-blocking retry configuration to be recognized.

False

broadleaf.messaging.nonblocking.retry.cloud.stream.back-off-check-interval

The amount of time to wait between polling attempts when consuming the retry bindings. This can be a somewhat relaxed value and does not need to be as frequent as a normal message channel polling frequency. Note, this is different (and generally shorter than) the backoff duration. Does not apply to all binder implementations. In the case of Kafka, this relates to org.springframework.kafka.support.Acknowledgment#nack(Duration) where the sleep duration will be the longest of either backOffCheckInterval, or maxPollInterval. The default maxPollInterval is 5 seconds.

15 seconds

broadleaf.messaging.nonblocking.retry.cloud.stream.pubSub.max-ack-extension-period

The amount of time you can extend a message’s acknowledgement deadline. Only applicable when using the pubsub binder.

600 seconds

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].consumer-binding

The consumer binding from which to poll for candidate retryable messages. This is the binding name alone (not the fully qualified property). For example, for a fully qualified binding property spring.cloud.stream.bindings.retryInput1, the consumer-binding value assigned here will be retryInput1. You may define your own binding configuration at this name in your property files, in which case the system will use what you have defined there. However, in the absence of pre-defined configuration at this binding name, the system will auto create a consumer binding that is suitable for most non-blocking retry use cases.

N/A

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].producer-binding

The producer binding used to send a message to park in the retry queue defined here. This is the binding name alone (not the fully qualified property). For example, for a fully qualified binding property spring.cloud.stream.bindings.retryOutput1, the producer-binding value assigned here will be retryOutput1. You may define your own binding configuration at this name in your property files, in which case the system will use what you have defined there. However, in the absence of pre-defined configuration at this binding name, the system will auto create a producer binding that is suitable for most non-blocking retry use cases.

N/A

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].original-producer-binding

The producer binding used to send the message back to the original channel to re-attempt processing.

N/A

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].max-attempts

The maximum number of retry attempts.

3

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].back-off

The backOff timeframe to wait before retrying a message.

3000 ms

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].dlq

Optional. The name of a broker channel to which messages that fail all non-blocking retries should be sent. This value is usually set on the final FixedRetryInfo in a sequence (or the first if only a single member sequence is used). Note, this is the name of the destination in the broker - not the channel binding name. For example, an input channel definition for an example dlq might look like spring.cloud.stream.bindings.messageInputDlq.destination=messageDlq, where messageDlq would be the value used for this property. If no dlq is provided, the final exceptional state is merely logged. Note - the system does not automatically create consumer bindings for the dlq. If you wish to consumer dead letters, you will need to independently configure bindings and write processing logic separately.

N/A

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].include[n]

Optional. The exception types that should be retried. If this and exclude are omitted, then all are allowed.

Empty list

broadleaf.messaging.nonblocking.retry.cloud.stream.(main-consumer-binding)[n].exclude[n]

Optional. The exception types that should not be retried. When the message processing throws these exceptions, the message goes straight to the DLQ (or is logged). If this and include are omitted, then all are allowed.

Empty list

Message Lock Takeover Properties

Properties related to message lock takeover

Property Description Default

broadleaf.message.lock.takeover.enabled

Whether takeover behavior is enabled.

False

broadleaf.message.lock.takeover.includeListenerNames[n]

List of listener names that should participate in takeover behavior. Cases must individually opt in.

Empty list

broadleaf.message.lock.takeover.default-stagnation-threshold

Default threshold beyond which uncompleted state message locks are considered stagnant.

900000 ms (15 minutes)

broadleaf.message.lock.takeover.(listenerName).(stagnationThreshold)

Explicit thresholds per listener name. If defined, will take priority over defaultStagnationThreshold.

N/A

Blocking Retry Properties

Properties related blocking retry configuration

Property Description Default

broadleaf.messaging.blocking.retry.cloud.stream.enabled

Whether the blocking retry feature is enabled. The feature must be enabled for any blocking retry configuration to be recognized.

False

broadleaf.messaging.blocking.retry.cloud.stream.pubsub.max-ack-extension-period

The amount of time you can extend a message’s acknowledgement deadline. Only applicable when using the pubsub binder.

600 seconds

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).kafka.seek-to-current-record-on-failure

Optional. When using the kafka binder, whether failures will be bubbled to the container in combination with a backoff duration, which facilitates seek to current record for retry. This behavior will prevent a possible kafka re-balance in the event the backoff exceeds the poll interval. If false, standard spring retry will be used, in which case, care should be taken that the aggregate of all processing, retries, and delays for a poll of records does not exceed the consumer’s max.poll.interval.ms (default 5 minutes) property. If not using the kafka binder, this setting has no effect.

True

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).use-defaults

If the default values are all satisfactory, the retry configuration can simply set this property to true, which will establish a BlockingRetryInfo associated with the targeted binding.

True

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).max-attempts

The maximum number of retry attempts.

3

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).back-off

The backOff timeframe to wait before retrying a message.

3000 ms

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).dlq

Optional. The name of a broker channel to which messages that fail all non-blocking retries should be sent. This value is usually set on the final FixedRetryInfo in a sequence (or the first if only a single member sequence is used). Note, this is the name of the destination in the broker - not the channel binding name. For example, an input channel definition for an example dlq might look like spring.cloud.stream.bindings.messageInputDlq.destination=messageDlq, where messageDlq would be the value used for this property. If no dlq is provided, the final exceptional state is merely logged. Note - the system does not automatically create consumer bindings for the dlq. If you wish to consumer dead letters, you will need to independently configure bindings and write processing logic separately.

N/A

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).include[n]

Optional. The exception types that should be retried. If this and exclude are omitted, then all are allowed.

Empty list

broadleaf.messaging.blocking.retry.cloud.stream.(main-consumer-binding).exclude[n]

Optional. The exception types that should not be retried. When the message processing throws these exceptions, the message goes straight to the DLQ (or is logged). If this and include are omitted, then all are allowed.

Empty list

Standard Retry Properties

Properties related to overall retry configuration

Property Description Default

broadleaf.messaging.retry.kafka.poll-timeout

The amount of time in milliseconds the kafka consumer will block waiting for poll max records to be returned. Shorten this timeframe for more frequent poll iterations.

5000 ms

broadleaf.messaging.retry.dlq.stack-trace-filters-regex[n]

Filter out lines in the stack trace that do not match any of the regular expressions included here. The filtered stack trace will be included as a message header (FAILURE_TRACE) for any failed message sent to a DLQ.

regex for broadleaf and spring packages

broadleaf.messaging.retry.dlq.max-trace-line-count

The maximum number of already filtered lines to include in the stack trace.

50