Class CloudEventHeadersBuilder

java.lang.Object
org.springframework.integration.support.MapBuilder<CloudEventHeadersBuilder, String, @Nullable Object>
org.springframework.integration.cloudevents.dsl.CloudEventHeadersBuilder

public class CloudEventHeadersBuilder extends MapBuilder<CloudEventHeadersBuilder, String, @Nullable Object>
The CloudEvent specific MapBuilder implementation.

Provide a fluent API for building CloudEvent headers with support for literal values, SpEL expressions, and function-based values.

Since:
7.1
Author:
Glenn Renfro
  • Constructor Details

    • CloudEventHeadersBuilder

      public CloudEventHeadersBuilder()
      Create a new CloudEventHeadersBuilder with default prefix.
    • CloudEventHeadersBuilder

      public CloudEventHeadersBuilder(String prefix)
      Create a new CloudEventHeadersBuilder with the given prefix.
      Parameters:
      prefix - the CloudEvent header prefix
  • Method Details

    • id

      Set the CloudEvent id.
      Parameters:
      id - the event id
      Returns:
      the builder
    • idExpression

      public CloudEventHeadersBuilder idExpression(String id)
      Set the expression that will be evaluated to determine the CloudEvent id.
      Parameters:
      id - the SpEL expression
      Returns:
      the builder
    • idFunction

      public <P> CloudEventHeadersBuilder idFunction(Function<Message<P>, String> id)
      Set a function that will be invoked to determine the CloudEvent id.
      Parameters:
      id - the function
      Returns:
      the builder
    • source

      public CloudEventHeadersBuilder source(URI source)
      Set the CloudEvent source.
      Parameters:
      source - the event source URI
      Returns:
      the builder
    • sourceExpression

      public CloudEventHeadersBuilder sourceExpression(String source)
      Set the expression that will be evaluated to determine the CloudEvent source.
      Parameters:
      source - the SpEL expression
      Returns:
      the builder
    • sourceFunction

      public <P> CloudEventHeadersBuilder sourceFunction(Function<Message<P>, URI> source)
      Set a function that will be invoked to determine the CloudEvent source.
      Parameters:
      source - the function
      Returns:
      the builder
    • type

      public CloudEventHeadersBuilder type(String type)
      Set the CloudEvent type.
      Parameters:
      type - the event type
      Returns:
      the builder
    • typeExpression

      public CloudEventHeadersBuilder typeExpression(String type)
      Set the expression that will be evaluated to determine the CloudEvent type.
      Parameters:
      type - the SpEL expression
      Returns:
      the builder
    • typeFunction

      public <P> CloudEventHeadersBuilder typeFunction(Function<Message<P>, String> type)
      Set a function that will be invoked to determine the CloudEvent type.
      Parameters:
      type - the function
      Returns:
      the builder
    • time

      public CloudEventHeadersBuilder time(@Nullable OffsetDateTime time)
      Set the CloudEvent time.
      Parameters:
      time - the event timestamp
      Returns:
      the builder
    • timeExpression

      public CloudEventHeadersBuilder timeExpression(String time)
      Set the expression that will be evaluated to determine the CloudEvent time.
      Parameters:
      time - the SpEL expression
      Returns:
      the builder
    • timeFunction

      public <P> CloudEventHeadersBuilder timeFunction(Function<Message<P>, OffsetDateTime> time)
      Set a function that will be invoked to determine the CloudEvent time.
      Parameters:
      time - the function
      Returns:
      the builder
    • subject

      public CloudEventHeadersBuilder subject(@Nullable String subject)
      Set the CloudEvent subject.
      Parameters:
      subject - the event subject
      Returns:
      the builder
    • subjectExpression

      public CloudEventHeadersBuilder subjectExpression(String subject)
      Set the expression that will be evaluated to determine the CloudEvent subject.
      Parameters:
      subject - the SpEL expression
      Returns:
      the builder
    • subjectFunction

      public <P> CloudEventHeadersBuilder subjectFunction(Function<Message<P>, String> subject)
      Set a function that will be invoked to determine the CloudEvent subject.
      Parameters:
      subject - the function
      Returns:
      the builder
    • dataContentType

      public CloudEventHeadersBuilder dataContentType(@Nullable String dataContentType)
      Set the CloudEvent data content type.
      Parameters:
      dataContentType - the data content type
      Returns:
      the builder
    • dataContentTypeExpression

      public CloudEventHeadersBuilder dataContentTypeExpression(String dataContentType)
      Set the expression that will be evaluated to determine the CloudEvent data content type.
      Parameters:
      dataContentType - the SpEL expression
      Returns:
      the builder
    • dataContentTypeFunction

      public <P> CloudEventHeadersBuilder dataContentTypeFunction(Function<Message<P>, String> dataContentType)
      Set a function that will be invoked to determine the CloudEvent data content type.
      Parameters:
      dataContentType - the function
      Returns:
      the builder
    • dataSchema

      public CloudEventHeadersBuilder dataSchema(@Nullable URI dataSchema)
      Set the CloudEvent data schema.
      Parameters:
      dataSchema - the data schema URI
      Returns:
      the builder
    • dataSchemaExpression

      public CloudEventHeadersBuilder dataSchemaExpression(String dataSchema)
      Set the expression that will be evaluated to determine the CloudEvent data schema.
      Parameters:
      dataSchema - the SpEL expression
      Returns:
      the builder
    • dataSchemaFunction

      public <P> CloudEventHeadersBuilder dataSchemaFunction(Function<Message<P>, URI> dataSchema)
      Set a function that will be invoked to determine the CloudEvent data schema.
      Parameters:
      dataSchema - the function
      Returns:
      the builder