Class ToCloudEventTransformerSpec
ToCloudEventTransformer.- Since:
- 7.1
- Author:
- Glenn Renfro, Artem Bilan
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate an instance with no extension patterns.protectedToCloudEventTransformerSpec(String... extensionPatterns) Create an instance with the provided extension patterns. -
Method Summary
Modifier and TypeMethodDescriptioncloudEventPrefix(String cloudEventPrefix) Set the prefix forCloudEventheaders in binary content mode.dataSchema(URI dataSchema) Set thedataSchemafor theCloudEvent.dataSchemaExpression(String dataSchemaExpression) Set the SpEL expression to create thedataSchemafor theCloudEvent.dataSchemaExpression(Expression dataSchemaExpression) dataSchemaFunction(Function<Message<?>, URI> dataSchemaFunction) eventFormat(io.cloudevents.core.format.EventFormat eventFormat) Set theEventFormatto use forCloudEventserialization.eventFormatContentType(String eventFormatContentType) Set the cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.eventFormatContentTypeExpression(String eventFormatContentTypeExpression) Set the SpEL expression to produce a cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.eventFormatContentTypeExpression(Expression eventFormatContentTypeExpression) Set theExpressionto produce a cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.eventFormatContentTypeFunction(Function<Message<?>, String> eventFormatContentTypeFunction) Set theFunctionto produce a cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.eventIdExpression(String eventIdExpression) Set the SpEL expression to createCloudEventid.eventIdExpression(Expression eventIdExpression) eventIdFunction(Function<Message<?>, String> eventIdFunction) get()Get theToCloudEventTransformerinstance created and configured by this builder.Set theCloudEventsource.sourceExpression(String sourceExpression) Set the SpEL expression to createCloudEventsource.sourceExpression(Expression sourceExpression) sourceFunction(Function<Message<?>, URI> sourceFunction) Set thesubjectfor theCloudEvent.subjectExpression(String subjectExpression) Set the SpEL expression to create thesubjectfor theCloudEvent.subjectExpression(Expression subjectExpression) subjectFunction(Function<Message<?>, String> subjectFunction) Set thetypefor theCloudEvent.typeExpression(String typeExpression) Set the SpEL expression to extract thetypefor theCloudEvent.typeExpression(Expression typeExpression) typeFunction(Function<Message<?>, String> typeFunction)
-
Field Details
-
PARSER
-
-
Constructor Details
-
ToCloudEventTransformerSpec
protected ToCloudEventTransformerSpec()Create an instance with no extension patterns. -
ToCloudEventTransformerSpec
Create an instance with the provided extension patterns.Extension patterns are used to match message headers that should be included as
CloudEventextensions. Patterns support wildcards (e.g., "myapp.*").- Parameters:
extensionPatterns- patterns to evaluate whether message headers should be added as extensions to theCloudEvent.
-
-
Method Details
-
eventFormat
Set theEventFormatto use forCloudEventserialization.If
eventFormatand theeventFormatContentTypeExpressionare provided, theeventFormathas precedence.- Parameters:
eventFormat- the event format for serializing CloudEvents- Returns:
- the spec for method chaining
-
eventIdExpression
Set the SpEL expression to createCloudEventid.Default is to extract the
idfrom theMessageHeadersof the message.- Parameters:
eventIdExpression- the SpEL expression to create theidfor eachCloudEvent- Returns:
- the spec
-
eventIdFunction
Set theFunctionto createCloudEventid.Default is to extract the
idfrom theMessageHeadersof the message.- Parameters:
eventIdFunction- theFunctionto create theidfor eachCloudEvent- Returns:
- the spec
-
eventIdExpression
Set theExpressionto createCloudEventid.Default is to extract the
idfrom theMessageHeadersof the message.- Parameters:
eventIdExpression- the expression to create theidfor eachCloudEvent- Returns:
- the spec
-
sourceExpression
Set the SpEL expression to createCloudEventsource.Default is
"/spring/" + appName + "." + getBeanName()).- Parameters:
sourceExpression- the SpEL expression to create thesourcefor eachCloudEvent- Returns:
- the spec
-
sourceFunction
-
source
Set theCloudEventsource.Default is
"/spring/" + appName + "." + getBeanName()).- Parameters:
source- thesourcefor eachCloudEvent- Returns:
- the spec
-
sourceExpression
Set theExpressionto createCloudEventsource.Default is
"/spring/" + appName + "." + getBeanName()).- Parameters:
sourceExpression- the expression to create thesourcefor eachCloudEvent- Returns:
- the spec
-
typeExpression
Set the SpEL expression to extract thetypefor theCloudEvent.- Parameters:
typeExpression- the SpEL expression to create thetypefor eachCloudEventDefault is
spring.message.- Returns:
- the spec
-
typeFunction
-
type
Set thetypefor theCloudEvent.- Parameters:
type- thetypefor eachCloudEventDefault is
spring.message.- Returns:
- the spec
-
typeExpression
- Parameters:
typeExpression- the expression to create thetypefor eachCloudEventDefault is
spring.message.- Returns:
- the spec
-
dataSchemaExpression
Set the SpEL expression to create thedataSchemafor theCloudEvent.- Parameters:
dataSchemaExpression- the SpEL expression to create thedataSchemafor eachCloudEvent- Returns:
- the spec
-
dataSchemaFunction
-
dataSchema
Set thedataSchemafor theCloudEvent.- Parameters:
dataSchema- thedataSchemafor eachCloudEvent- Returns:
- the spec
-
dataSchemaExpression
- Parameters:
dataSchemaExpression- the expression to create thedataSchemafor eachCloudEvent- Returns:
- the spec
-
subjectExpression
Set the SpEL expression to create thesubjectfor theCloudEvent.- Parameters:
subjectExpression- the SpEL expression to create thesubjectfor eachCloudEvent- Returns:
- the spec
-
subjectFunction
-
subject
Set thesubjectfor theCloudEvent.- Parameters:
subject- thesubjectfor eachCloudEvent- Returns:
- the spec
-
subjectExpression
- Parameters:
subjectExpression- the expression to create thesubjectfor eachCloudEvent- Returns:
- the spec
-
eventFormatContentTypeExpression
public ToCloudEventTransformerSpec eventFormatContentTypeExpression(String eventFormatContentTypeExpression) Set the SpEL expression to produce a cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.If
eventFormatand theeventFormatContentTypeExpressionare provided, theeventFormathas precedence.- Parameters:
eventFormatContentTypeExpression- the SpEL expression to evaluate a content type for theEventFormatProvider.resolveFormat(String)- Returns:
- the spec
-
eventFormatContentTypeFunction
public ToCloudEventTransformerSpec eventFormatContentTypeFunction(Function<Message<?>, String> eventFormatContentTypeFunction) Set theFunctionto produce a cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.If
eventFormatand theeventFormatContentTypeExpressionare provided, theeventFormathas precedence.- Parameters:
eventFormatContentTypeFunction- theFunctionto evaluate a content type for theEventFormatProvider.resolveFormat(String)- Returns:
- the spec
-
eventFormatContentType
Set the cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.If
eventFormatand theeventFormatContentTypeare provided, theeventFormathas precedence.- Parameters:
eventFormatContentType- theFunctionto evaluate a content type for theEventFormatProvider.resolveFormat(String)- Returns:
- the spec
-
eventFormatContentTypeExpression
public ToCloudEventTransformerSpec eventFormatContentTypeExpression(Expression eventFormatContentTypeExpression) Set theExpressionto produce a cloud event format content type whenEventFormatProvideris to be used to determineEventFormat.If
eventFormatand theeventFormatContentTypeExpressionare provided, theeventFormathas precedence.- Parameters:
eventFormatContentTypeExpression- theExpressionto evaluate a content type for theEventFormatProvider.resolveFormat(String)- Returns:
- the spec
-
cloudEventPrefix
Set the prefix forCloudEventheaders in binary content mode.Default is
CloudEventHeaders.PREFIX.- Parameters:
cloudEventPrefix- the prefix to use forCloudEventheaders- Returns:
- the spec
-
get
Get theToCloudEventTransformerinstance created and configured by this builder.This method provides access to the transformer for advanced configuration or direct use outside the DSL context.
- Returns:
- the configured
ToCloudEventTransformer
-