SimpleMessageFunctionAccessor

data class SimpleMessageFunctionAccessor<P : Any, in M : MessageExchange<*, *>, out R>(val processor: P, val metadata: FunctionAccessorMetadata<P, R>) : MessageFunctionAccessor<P, M, R>

A simple message function accessor for functions without injectable parameters.

This accessor handles functions that only need the primary message parameter and don't require dependency injection for additional parameters.

Parameters

P

The processor type

M

The message exchange type

R

The return type

Constructors

Link copied to clipboard
constructor(processor: P, metadata: FunctionAccessorMetadata<P, R>)

Properties

Link copied to clipboard
open override val contextName: String

The name of the bounded context, obtained from the metadata.

Link copied to clipboard
open override val functionKind: FunctionKind

The kind of the function (e.g., command, event), obtained from the metadata.

Link copied to clipboard
open override val metadata: FunctionAccessorMetadata<P, R>

The function metadata

Link copied to clipboard
open override val name: String

The name of the function, obtained from the metadata.

Link copied to clipboard
open override val processor: P

The processor instance

Link copied to clipboard
open override val processorName: String

The name of the processor, obtained from the metadata.

Link copied to clipboard
open override val qualifiedName: String

The fully qualified name of the function, formatted as "processorName.functionName(supportedTypeSimpleName)". This provides a unique identifier for the function.

Link copied to clipboard
open override val supportedTopics: Set<NamedAggregate>

The set of supported topics, obtained from the metadata.

Link copied to clipboard
open override val supportedType: Class<*>

The supported message body type, obtained from the metadata.

Functions

Link copied to clipboard
open override fun <A : Annotation> getAnnotation(annotationClass: Class<A>): A?

Retrieves an annotation from the function's accessor using reflection.

Link copied to clipboard
fun NamedBoundedContext.getContextAlias(boundedContext: BoundedContext? = MetadataSearcher.metadata.contexts[contextName]): String
Link copied to clipboard

Gets the context alias prefix for this bounded context.

Link copied to clipboard
open fun handle(exchange: M): R

Handles the message exchange by invoking the function. This method provides an alternative way to process the exchange.

Link copied to clipboard
open operator override fun invoke(exchange: M): R

Invokes the function with the message exchange.

Link copied to clipboard
open fun isEmpty(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isSameFunction(functionInfo: FunctionInfo): Boolean
Link copied to clipboard

Checks if a function matches the criteria specified by this NamedFunctionInfo. Used to determine if a wait strategy should be notified about a specific function execution. Returns true if all specified criteria (context, processor, name) match or are not specified.

Link copied to clipboard

Checks if the given message is supported by this function. A message is supported if its body is an instance of the supported type and its aggregate matches one of the supported topics.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun FunctionInfo.toWaitSignal(id: String, waitCommandId: String, commandId: String, aggregateId: AggregateId, stage: CommandStage, isLastProjection: Boolean = false, aggregateVersion: Int? = null, errorCode: String = ErrorCodes.SUCCEEDED, errorMsg: String = ErrorCodes.SUCCEEDED_MESSAGE, bindingErrors: List<BindingError> = emptyList(), result: Map<String, Any> = emptyMap(), commands: List<String> = listOf(), signalTime: Long = System.currentTimeMillis()): WaitSignal