VOOZH about

URL: https://www.geeksforgeeks.org/advance-java/spring-cloud-stream-composed-functions/

⇱ Spring Cloud Stream - Composed Functions or EIP - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Spring Cloud Stream - Composed Functions or EIP

Last Updated : 28 Apr, 2025

Spring Cloud Stream is a framework for creating highly scalable event-driven microservices that communicate over common messaging systems. The framework provides a versatile programming architecture based on well-known Spring idioms and best practices, such as support for persistent pub/sub semantics, consumer groups, and stateful partitioning.

Spring Cloud Stream Core Building Blocks

  • Message: The standard data format that producers and consumers use to exchange information with Destination Binders.
  • Destination Binders: Parts in charge of offering integration with outside message platforms.
  • Destination Bindings: A link between the application code that the end user provides and the external messaging services.

Composed Functions or EIP

Function Composition

A declarative method of composing many functions together is possible using SCF's function composition feature. This is demonstrated by the example as below:

--spring.cloud.function.definition=uppercase|reverse

Enterprise Integration Patterns (EIP)

A collection of precisely defined and comprehended patterns, known as enterprise integration, patterns, enables you to characterize a business case. Filter, transformer, router, and so forth are a few examples. Click this link to learn more about EIP. Spring provides a reference implementation of EIP using the Spring Integration framework.

IntegrationFlow.fromChannel(inputChannel)
.transform(uppercase)
.transform(reverse);

Using Two Applications Spring Cloud Stream - Composed Functions

The functionality of the two apps in the Stream (http | transformer) is combined into a single application, which we construct and register. The new stream is then put into use, and we confirm that the output matches that of the prior example.

Conclusion

So, this is Spring Cloud Stream - Composed Functions or EIP. For orchestrating capabilities that are aligned in sequence, SCF Composition is a better fit, whereas SI is a better option for anything else that falls within the EIP category.

Comment

Explore